I have a simple email validation script. After email is validated the script writes a cookie, then opens a new window.
For the life of me I cannot figure out what why window.open will not work. (It works when I remove the cookie setting code. But not with it???).
What am I missing here?
[CODE]function emailCheck(emailStr) {
// checks if the e-mail address is valid
var emailPat = /^([A-Za-z0-9_-.])+@([A-Za-z0-9_-.])+.([A-Za-z]{2,4})$/;
var matchArray = emailStr.match(emailPat);
if (matchArray == null) {
alert(“Your email address seems incorrect. Please try again (check the ‘@’ and ‘.’s in the email address)”);
return false;
}
// make sure the IP address domain is valid
var IPArray = matchArray[2].match(/^[(d{1,3}).(d{1,3}).(d{1,3}).(d{1,3})]$/);
if (IPArray != null) {
for (var i=1;i<=4;i++) {
if (IPArray[i]>255) {
alert(“Destination IP address is invalid!”)
return false;
}
}
}
var email1 = document.email_capture.email.value;
var expires = new Date();
expires.setDate(expires.getDate() + 1825); // 1825 = days to expire
document.cookie = “email2= “+ escape(email1)+”; expires=”+ expires.toGMTString()+”; path=/; domain=localhost”;
window.open(“http://www.testing.com”, ‘_new’,’fullscreen=yes, scrollbars=auto’);
return true;
}