function isSpclChar() {
var iChars = "!@#$%^&*()+=[]\\\';,./{}|\":<>?";
var val = document.getElementById('<%=txtdocNo.ClientID%>').value;
for (var i = 0; i < val.length; i++) {
if (iChars.indexOf(val.charAt(i)) != -1) {
{
alert("The box has special characters. \nThese are not allowed.\n");
document.getElementById('<%=txtdocNo.ClientID%>').value = '';
return false;
}
}
}
}
source from
http://www.dotnetspider.com/resources/28200-Special-character-Validation.aspx
function chkSpecialChars(input)
{
var iChars = "!@#$%^&*()+=-[]\\\';,./{}|\":<>?"; for (var i = 0; i < input.length; i++)
{
if (iChars.indexOf(input.charAt(i)) != -1)
{
alert ("You are using special characters. \nThese are not allowed.\n Please remove them and try again.");
return false;
}
}
return true;
}
//password validation