Develop an HTML page for registration to collect user registration information. Including: Name (cannot be blank), age (must exceed 17 years old), weight (30-150 kg), Class (drop-down list), login password (at least 8 characters long) confirm the password (consistent with the logon password), Email (cannot be blank), phone number, QQ, resume, and other information. And create corresponding verification for the elements of these tables. If an error is detected, the error is displayed in red after the input box. Use the single-line text input box text, drop-down list box select, password input box password, and multi-line text input box textarea learned in the previous sections. This is a more practical user registry ticket ..
Register.html:
<Script type = text/javascript src = load. js> </script>
Check.css:
td.check{color:#C00;font-weight:bold;}
Load. js:
Function check (str) {var x = document. getElementById (str); var y = document. getElementById (str + Check); // alert (check !); If (str = name) {if (x. value =) y. hidden = false; elsey. hidden = true;} else if (str = age) {if (isNaN (x. value) | x. value <17) y. hidden = false; elsey. hidden = true;} else if (str = weight) {x = x. value; if (isNaN (x) ||x <30 | x> 150) y. hidden = false; elsey. hidden = true;} else if (str = password) {x = x. value. length; if (x <8) {y. hidden = false; // alert (check !);} Elsey. hidden = true;} else if (str = cpassword) {var z = document. getElementById (password). value; x = x. value; if (x! = Z) y. hidden = false; elsey. hidden = true;} else if (str = email) {x = x. value. indexOf (@) if (x =-1) y. hidden = false; elsey. hidden = true;} return y. hidden;} function validate () {var arr = [name, age, weight, password, cpassword, email]; var I = 0; submitOK = true; while (I <= 5) {if (! Check (arr [I]) {alert (arr [I] + wrong !); SubmitOK = false; break;} I ++;} if (submitOK) {alert (submitted successfully !); Return true;} else {alert (submission failed); return false ;}} function load_greeting () {// alert (visit );}