Special Charecters: var iChars = "!@#$%^&*()+=-[]\\\';,./{}|\":<>?"; for (var i = 0; i < document.formname.fieldname.value.length; i++) { if (iChars.indexOf(document.formname.fieldname.value.charAt(i)) != -1) { alert ("Your username has special characters. \nThese are not allowed.\n Please remove them and try again."); return false; } } -----------------------------------------------------------Alpha , Numeric & Special Charecter <script language="javascript"> function isStrongPassword() { var control = document.form1.password; var myString= control.value; var Stringlen = myString.length; var ValidateDigits = /[^0-9]/g; var ValidateSpChar = /[a-zA-Z0-9]/g; var ValidateChar = /[^a-zA-Z]/g; var digitString = myString.replace(ValidateDigits , ""); var specialString = myString.replace(ValidateSpChar, ""); var charString = myString.replace(ValidateChar, ""); if(Stringlen < 8) { alert("Passwords must be at least 8 characters"); control.value=""; control.focus(); return false; } if(specialString < 1) { alert("Passwords must include at least 1 special (#,@,&,$ etc) characters"); control.value=""; control.focus();
return false; } if(digitString < 1) { alert("Passwords must include at least 1 numeric characters"); control.value=""; control.focus(); return false; } return; }
Registration