prash21m 0 Newbie Poster

Hi there,

I have a php script that contain java script codes to show pop up email registration form, but these codes does not work. can anybody suggest me how to make it to work ? Below is the code that i have on my script.

**Maybe to set cookie : **

<script type="text/javascript"> 
function ReadCookie(cookieName) { 
var theCookie=" "+document.cookie; 
var ind=theCookie.indexOf(" "+cookieName+"="); 
if (ind==-1) ind=theCookie.indexOf(";"+cookieName+"="); 
if (ind==-1 || cookieName=="") return ""; 
var ind1=theCookie.indexOf(";",ind+1); 
if (ind1==-1) ind1=theCookie.length; 
return unescape(theCookie.substring(ind+cookieName.length+2,ind1)); 
} 

function SetCookie(cookieName,cookieValue,nDays,domain) { 
var today = new Date(); 
var expire = new Date(); 
if (nDays==null || nDays==0) nDays=1; 
expire.setTime(today.getTime() + 3600000*nDays); 
if(domain != ''){ 
document.cookie = cookieName+"="+escape(cookieValue) + ";expires="+expire.toGMTString()+";domain="+domain+";path=/"; 
}else{ 
document.cookie = cookieName+"="+escape(cookieValue) + ";expires="+expire.toGMTString(); 
} 
} 
</script>

Maybe to populate a popup registration form. But dont know how to let it to work :

<script> 

function validate(){ 
var val = document.getElementById('email_popup_registration').value; 
val = jQuery.trim(val); 
document.getElementById('email_popup_registration').value = val; 
if(val== '' || val=='Your Email Address'){ 
document.getElementById('email_popup_registration').style.color = "#000"; 
document.getElementById('email_popup_registration').style.background = "#EF3F70"; 
document.getElementById('email_popup_registration').value = 'Your Email Address'; 
return false; 
}else{ 
var filter = /^\w[a-zA-Z0-9-_.]+@[a-zA-Z_]+.[a-zA-Z]+.[a-zA-Z]{2,3}$/; 
if(String(document.getElementById('email_popup_registration').value).search (filter) == -1) 
{ 
document.getElementById('email_popup_registration').style.color = "#000"; 
document.getElementById('email_popup_registration').style.background = "#FFF"; 
document.getElementById('email_popup_registration').value = 'Your Email Address'; 
return false; 
} 
} 
} 

jQuery("#email_popup_registration").bind('blur',function(){ 
var val = document.getElementById('email_popup_registration').value; 
val = jQuery.trim(val); 
document.getElementById('email_popup_registration').value = val; 
if(val== '' || val=='Your Email Address'){ 
document.getElementById('email_popup_registration').style.color = "#000"; 
document.getElementById('email_popup_registration').value = 'Your Email Address'; 
} 
}); 
jQuery("#email_popup_registration").bind('focus',function(){ 
var val = document.getElementById('email_popup_registration').value; 

if(val=='Your Email Address'){ 
document.getElementById('email_popup_registration').style.color = "#000"; 
document.getElementById('email_popup_registration').value = ''; 
} 

}); 




</script>

**And don't know about these codes : **

<script type="text/javascript"> 


var force_login = 'NO'; 
var force_signin_pages = 'productview'; 
var page = 'index'; 

var page_id = ''; 
if(page == 'productview'){ 

page_id = ''; 

}else if(page == 'brand'){ 

page_id = ''; 

} 
if(page_id != '') { 
var page_name = page+'-'+page_id; 
page_list = force_signin_pages.split(','); 
close_popup = 'YES'; 
for(var i=0; i<page_list.length; i++) { 
if(page_name == page_list['i'] && force_login == 'YES' && page != 'index'){ 
close_popup = 'NO'; 
} 
} 
}else{ 
close_popup = 'YES'; 
} 
var cookie_status = ReadCookie('skip_express_reg'); 
if((cookie_status == '' && $.browser.mobile == false ) || (close_popup == 'YES' && $.browser.mobile == false ) ) 
{ 

if(cookie_status != 'skip'){ 
document.getElementById('popup_exp_reg').style.display="block"; 
} 
SetCookie('skip_express_reg','skip','6',''); 
}else if($.browser.mobile == false){ 
var force_signin_cookie_status = ReadCookie('force_signin'); 
if(force_signin_cookie_status != 'skip'){ 
document.getElementById('popup_exp_reg').style.display="block"; 
document.getElementById('popup_close').style.display="none"; 
} 
} 



$('#popup_close').click(function(){ 
$('#popup_exp_reg').hide(); 
}); 

</script>

Please help me to populate the popup window useing above codes...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.