1var at = document.getElementById("email").value.indexOf("@");
2var age = document.getElementById("age").value;
3var fname = document.getElementById("fname").value;
4submitOK = "true";
5
6if (fname.length > 10) {
7 alert("The name may have no more than 10 characters");
8 submitOK = "false";
9}
10
11if (isNaN(age) || age < 1 || age > 100) {
12 alert("The age must be a number between 1 and 100");
13 submitOK = "false";
14}
15
16if (at == -1) {
17 alert("Not a valid e-mail!");
18 submitOK = "false";
19}
20
21if (submitOK == "false") {
22 return false;
23}