Javascript Code for Block work of Back space key, Enter key and All Character and Sign keys

Jeetu_choudhary12
Posted by Jeetu_choudhary12 under JavaScript category on | Points: 40 | Views : 3922
function CHKNUM(e,idtxt)
{
var txt = document.getElementById(idtxt);

if(e.keyCode < 48 || e.keyCode > 57)// && ( keyCode != 8 || e.keyCode != 13))
{

if(e.keyCode != 13 && e.keyCode != 8)
{
alert("keyCode for the key pressed: " + e.keyCode + "\n");
alert("Please enter Numbers Only.");
txt.value="";
txt.focus();
return false;
}
}
else
{
return true;
}

Comments or Responses

Login to post response