lundi 29 décembre 2014

i want to make an validation in javascript on my form but its not working properly so pls help me


var ck_name = /^[A-z]+$/; var ck_email = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/; var ck_username = /^[A-Za-z0-9_]{1,20}$/; var ck_password = /^[A-Za-z0-9!@#$%^&*()_]{6,20}$/; function validate() { var name = document.form.name; var email = document.form.email; var username = document.form.username; var password = document.form.password; if (!ck_name.test(name)) { window.alert("You must enter valid Name ."); name.focus(); return false; } if (!ck_email.test(email)) { window.alert("You must enter a valid email address."); email.focus(); return false; } if (!ck_username.test(username)) { window.alert("Your valid UserName does not contain any special char."); username.focus(); return false; } if (!ck_password.test(password)) { window.alert("You must enter a valid Password "); password.focus(); return false; } return true; }

Name:


E-mail:


UserName:


Password:





Aucun commentaire:

Enregistrer un commentaire