common.js
contents are as follows:
function isNumeric(obj,event) {
if (window.event) {
keycode = window.event.keyCode;
//kc 9 = tab
if (keycode == 9){
return;
}
// keycode LeftArrow, RightArrow, UpArrow, DownArrow if so ignore
if(keycode >= 37 && keycode <= 40){
return;
}
}
var num = obj.value;
var ret = false;
var newStr = “”;
var badDigits = “”;
for(var index = 0; index < num.length; index++) {
var chkDigit = num.charAt(index);
if(chkDigit >= 0 && chkDigit <= 9) {
newStr = newStr + chkDigit;
} else {
badDigits = badDigits + chkDigit;
}
}
obj.value = newStr;
if(badDigits.length > 0) {
if (num.length == 1) {
window.alert(‘Invalid value was typed. (‘ + badDigits + ‘) will be replaced with 0 ‘ );
obj.value = ‘0’;
obj.focus();
obj.select();
ret = false;
} else {
window.alert(‘Invalid value was typed. (‘ + badDigits + ‘) will be removed. ‘ );
obj.focus();
ret = false;
}
} else {
ret = true;
}
return ret;
}