Please help me to figure out why this form isnt working at all..
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Registration Form</title>
</head>
<body>
<script type='text/javascript'>
function formValidator(){
var name = document.getElementById('name');
var email = document.getElementById('email');
var password = document.getElementById('password');
if(notEmpty(name, "Please enter only letters for your First name")){
if(lr(password, 6, 12)){
if(notEmpty(email, "Please enter only letters for your Last Name")){
return true;
}
}
}
return false;
}
function notEmpty(elem, helperMsg){
if(elem.value.length == 0){
alert(helperMsg);
elem.focus();
return false;
}
return true;
}
function lr(elem, min, max){
var uInput = elem.value;
if(uInput.length >= min && uInput.length <= max){
return true;
}else{
alert("Please enter between " +min+ " and " +max+ " characters");
elem.focus();
return false;
}
}
</SCRIPT>
<form action='' onsubmit='return formValidator()' name='myform' method='get' >
<table width="425" height="166" border="0">
<tr>
<td colspan="2"><h1>Registration Form </h1></td>
</tr>
<tr>
<td width="122">Name</td>
<td width="287">
<input name="name" type="text" id="name" maxlength="15" />
</td>
</tr>
<tr>
<td>Email Address </td>
<td><input name="email" type="text" id="email" maxlength="15" /></td>
</tr>
<tr>
<td>Password</td>
<td><input name="password" type="password" id="password" /></td>
</tr>
<tr>
<td> </td>
<td><input type="button" name="Submit" value="Submit" onmouseover=" document.myform.submit()" />
<input type="reset" name="reset" value="Reset" /></td>
</tr>
</table>
</form>
</body>
</html>