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.valu e ) ) {
alert( errorMsg);
emailField.focu s();
emailField.sele ct();
return false;
} else {
//return true;
parent.frame_to p.top_value = emailField.valu e;
document.getEle mentById('mail' ).className='hi ddenDiv';
getNextPage();
}
}
//-->
</script>
</script>
</head>
<body>
<h2>test</h2>
<div id="mail" class="visibleD iv">
<form name="emailForm " onsubmit="valid ateEmail( 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]
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.valu e ) ) {
alert( errorMsg);
emailField.focu s();
emailField.sele ct();
return false;
} else {
//return true;
parent.frame_to p.top_value = emailField.valu e;
document.getEle mentById('mail' ).className='hi ddenDiv';
getNextPage();
}
}
//-->
</script>
</script>
</head>
<body>
<h2>test</h2>
<div id="mail" class="visibleD iv">
<form name="emailForm " onsubmit="valid ateEmail( 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]
Comment