Java script for accept only numbers
function fnCheckIntegerValue(e, o) {
var vTxtVal = o.value;
var sTst = false;
evt = e || window.event;
var keyPressed = evt.which || evt.keyCode;
if (keyPressed < 58 && keyPressed > 47) {
sTst = true;
}
else {
//o.value = vTxtVal;
//e.returnValue = false;
sTst = false;
}
return sTst;
}
Event in submit button
onkeypress="return fnCheckIntegerValue(event, this);"
var vTxtVal = o.value;
var sTst = false;
evt = e || window.event;
var keyPressed = evt.which || evt.keyCode;
if (keyPressed < 58 && keyPressed > 47) {
sTst = true;
}
else {
//o.value = vTxtVal;
//e.returnValue = false;
sTst = false;
}
return sTst;
}
Event in submit button
onkeypress="return fnCheckIntegerValue(event, this);"
Comments
Post a Comment