Hello
I cannot see why this is not working - the idea being to check the
email address entered and if OK to move to either one of 2 pages - the
move does not happen.
The code below is in the lower of 2 frames.
Why?!
Cheers
Geoff
function getNextPage(){
var num = Math.random();
if (num<.5) {
location.href=" group1/group1-lab1.htm";
} else {
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 {
getNextPage();
}
}
//-->
</script>
</head>
<body>
<h2>test</h2>
<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>
I cannot see why this is not working - the idea being to check the
email address entered and if OK to move to either one of 2 pages - the
move does not happen.
The code below is in the lower of 2 frames.
Why?!
Cheers
Geoff
function getNextPage(){
var num = Math.random();
if (num<.5) {
location.href=" group1/group1-lab1.htm";
} else {
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 {
getNextPage();
}
}
//-->
</script>
</head>
<body>
<h2>test</h2>
<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>
Comment