Javascript all key validation
function validateNumberKey(event) {
var key = window.event ? event.keyCode : event.which;
if (event.keyCode == 8 || event.keyCode == 46
|| event.keyCode == 37 || event.keyCode == 39 || event.keyCode == 9) {
return true;
}
else if ( key < 48 || key > 57 ) {
return false;
}
else return true;
}
function validateAlphaNumericKey(event) {
var key = window.event ? event.keyCode : event.which;
if (event.keyCode == 8 || event.keyCode == 46
|| event.keyCode == 37 || event.keyCode == 39 || event.keyCode == 9) {
return true;
}
else if ( key >= 48 && key <= 57 )
{
return true;
}
else if ( key >= 65 && key <= 90 )
{
return true;
}
else if ( key >= 97 && key <= 122 )
{
return true;
}
else return false;
}
function validateAlphabeticKey(event) {
var key = window.event ? event.keyCode : event.which;
if (event.keyCode == 8 || event.keyCode == 46
|| event.keyCode == 37 || event.keyCode == 39 || event.keyCode == 9) {
return true;
}
else if ( key >= 65 && key <= 90 )
{
return true;
}
else if ( key >= 97 && key <= 122 )
{
return true;
}
else return false;
}
Number :
AlphaNumeric :
Alphabetic :
No comments:
Post a Comment
Please mention your comments.......