function validate() { if (document.signup.username.value=='') { alert('Enter your username'); document.signup.username.focus(); return false; } if (document.signup.password.value=='') { alert('Enter your password'); document.signup.password.focus(); return false; } if (document.signup.rpassword.value=='') { alert('Enter your Retypepassword'); document.signup.rpassword.focus(); return false; } if (document.signup.password.value!=document.signup.rpassword.value) { alert('Your password and Retypepassowrd are not same'); document.signup.rpassword.focus(); return false; } if (document.signup.email.value=='') { alert('Enter your email'); document.signup.email.focus(); return false; } var emailID=document.signup.email if ((emailID.value==null)||(emailID.value=="")){ alert(" Email Id is required") emailID.focus() return false } if (echeck(emailID.value)==false){ //emailID.value="" emailID.focus() return false } function echeck(str) { var at="@" var dot="." var lat=str.indexOf(at) var lstr=str.length var ldot=str.indexOf(dot) if (str.indexOf(at)==-1){ alert("Invalid E-mail Id") return false } if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){ alert("Invalid E-mail Id") return false } if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){ alert("Invalid E-mail Id") return false } if (str.indexOf(at,(lat+1))!=-1){ alert("Invalid E-mail Id") return false } if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){ alert("Invalid E-mail Id") return false } if (str.indexOf(dot,(lat+2))==-1){ alert("Invalid E-mail Id") return false } if (str.indexOf(" ")!=-1){ alert("Invalid E-mail Id") return false } } if (document.signup.country.selectedIndex==0) { alert('Select the location'); document.signup.country.focus(); return false; } if (document.signup.post.value=='') { alert('Enter your Postalcode'); document.signup.post.focus(); return false; } function isInteger(value) { return (parseInt(value) == value); } var integer = /^\d+$/; var valid = true; var output = ''; if (!isInteger(document.signup.post.value)) { valid = false; output += 'Invalid integer value entered\n'; } if (!valid) {alert(output); document.signup.post.focus(); return false;} if (document.signup.birthday_mon.selectedIndex==0) { alert('Select the month of dateofbirth'); document.signup.birthday_mon.focus(); return false; } if (document.signup.birthday_day.selectedIndex==0) { alert('Select the day of dateofbirth'); document.signup.birthday_day.focus(); return false; } if (document.signup.birthday_yr.selectedIndex==0) { alert('Select the year of dateofbirth'); document.signup.birthday_yr.focus(); return false; } if (document.signup.gender[0].checked==false && document.signup.gender[1].checked==false) { alert('Select gender'); return false; } } function validateme() { if (document.login.user.value=='') { alert('Enter your username'); document.login.user.focus(); return false; } if (document.login.pass.value=='') { alert('Enter your password'); document.login.pass.focus(); return false; } }
| ||||||||||||
|
||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
||||||||||||
|
||||||||||||
|