<html>
<head>
<title>Validator</title>
<script type="text/javascript">
function checkForm(form) {
for (var i = 0; i < form.elements.length; i++) {
if (form.elements[i].type == "text" && form.elements[i].value == "") {
document.write("Fill out ALL fields.");
return false;
}
}
return true;
}
</script>
</head>
<body>
<form onsubmit="return checkForm(this)">
Please enter all requested information:<br>
First Name:<input type="text" name="firstName"><br>
Last Name:<input type="text" name="lastName"><br>
Rank:<input type="text" name="rank"><br>
Serial Number:<input type="text" name="serialNumber"><br>
<input type="submit">
</form>
</body>
</html>
|