script implements username and password verification
Form Verify
Get the content entered by the user
var value = obj.value;
/3.Get span
var span = document.getElementById('s1');
span.innerHTML = "";
if (reg.test(value)) {
span.innerHTML = 'Username cannot be empty' ;
var checkPwd Password box
var pwd = document.forms[0]['pwd'];
var reg = /^s*$/;
var span = document.getElementById ('s2');
span.className = 'error'; > return false; span.innerHTML = 'Password length cannot be less than 6 characters';
;
return false; 🎜>var repwd = document.forms[0]['re1'];
> var span = document.getElementById('s3');
span.innerHTML = ''; 🎜> span.innerHTML = 'Two passwords are inconsistent';
span.className = 'error'; span.innerHTML = 'ok';
span.className = 'info';
return true;
) {
//3. Get span username') {
var span = document.getElementById('s1');
span.innerHTML = 'Username is required';
span.className = 'info';
> The password length cannot be less than 6 characters!';
className = 'info';
Provide id value for input document.getElmentById();
//2. Get tbody,tbody.getElementsByTagName('input');
//Document.forms can get all form objects in the document
/ /documeents.Forms [0] [name | ID]
var nameinput = document.forms [0] ['username'];
console.log (nameinput); return checkName(nameInput) && checkPwd() && checkRepwd();
}
用户注册