hello
the code below checks for a valid email address and then should move to either of 2 pages but no move happens! Why?
Thanks
Geoff
[HTML]<script>
function getNextPage(){
var num = Math.random();
if (num<.5) {
alert('going to 1');
location.href='group1/group1-lab1.htm';
} else {
alert('going to 2');
location.href='group2/group2-lab1.htm';
}
}
function validateEmail ( emailField, errorMsg ) {
emailpat =
/^([a-zA-Z0-9])+([\.a-zA-Z0-9_-])*@([a-zA-Z0-9])+(\.[a-zA-Z0-9_-]+)+$/;
if( !emailpat.test( emailField.value ) ) {
alert( errorMsg);
emailField.focus();
emailField.select();
return false;
} else {
//return true;
parent.frame_top.top_value = emailField.value;
document.getElementById('mail').className='hiddenD iv';
getNextPage();
}
}
//-->
</script>
</script>
</head>
<body>
<h2>test</h2>
<div id="mail" class="visibleDiv">
<form name="emailForm" onsubmit="validateEmail( this.email , 'Please enter a valid email address')">
Please enter your email address <input type="text" name="email">
<input type="submit" value="enter">
</form>
</div>[/HTML]