//The IndexOf method can be used to check if one character is inside of another. For example, suppose you want to check an email address to see if it contains the @ character. If it doesn't you can tell the user that it's an invalid email address.
script type="text/javascript" language ="javascript" >
function checkSpecialCharacters() {
var str = "'!#$%^&;*()";
var txtUserId = document.getElementById('txtUserId').value;
var txtPassword = document.getElementById('txtPassword').value;
var txt = txtUserId + txtPassword;
for (var i = 0; i < str.length; i++) {
var char1 = str.substr(i, 1)
if (txt.indexOf(char1) > -1) {
alert('special character(s) are not allowed in loginid/password');
//alert(obj.getMessage(196));
return false;
}
}
}
/script>
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment