Works in IE but not Netscape

wxdqz

New Member
Can one of the Gurus have a quick look at this please as the validation works for me in IE but not NS??




<html>

<head>
<title>New Page 1</title>

<script>

<!--
function validateform()
{
if(document.form1.name.value=="") {
window.alert ("Please Enter a Name!");
form1.name.focus();
return (false);
}
if(document.form1.dept.value=="") {
window.alert ("Please Enter your Department!");
form1.dept.focus();
return (false);
}

if (/\D/g.test(form1.idnum.value) || (form1.idnum.value == ''))
{
alert ("You have not entered your ID Number!");
form1.idnum.value = "";
form1.idnum.focus();
return false;
}

if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(form1.email.value)){
return (true);
}
alert ("Missing or Invalid E-mail Address! Please re-enter.");
form1.email.focus();
return (false);
}

//-->
</script>
</head>

<body>

<form method="POST" name="form1" action="" onSubmit="return validateform( this )">
<p>NAME:<input type="text" name="name" size="20"></p>
<p>DEPT:<input type="text" name="dept" size="20"></p>
<p>ID NUM:<input type="text" name="idnum" size="20"></p>
<p>EMAIL:<input type="text" name="email" size="20"></p>

<p><input type="submit" value=http://www.webdeveloper.com/forum/archive/index.php/"Submit" name="sub1"><input type="reset" value="Reset" name="reset1"></p>
</form>

</body>

</html>
 
Back
Top