Does anyone know how to make sure JavaScript validation works in FireFox?
All I want the javascript to do is display an alert box saying a box has not had any data entered and the code is simple with below an example.
<script>
function validate()
{
if (myform.username.value=="")
{
alert("No User Name entered");
myform.username.focus();
return false;
}
if (myform.password.value=="")
{
alert("No Password entered");
myform.password.focus();
return false;
}
return true;
}
</script>
<form name ="myform" action= "checkpassword.asp" method= "post" onSubmit="return validate()">
Username: <input type= "text" name= "username" size="10">
Password:
<input type="password" name= "password" size="10">
<input type="submit" value= "Login">
</form>
It's simple code, Firefox has JavaScript enabled. I have also tested it in IE, Opera and Safari and they all display the alert box as intended when nothing entered
|