<pre lang="cs">function allowOnlyNumber(eventInstance) {
eventInstance = eventInstance || window.event;
key = eventInstance.keyCode || eventInstance.which;
if ((47 < key) && (key < 58) || key == 8 || key == 189 || key == 109) {
return true;
} else {
if (eventInstance.preventDefault)
eventInstance.preventDefault();
eventInstance.returnValue = false;
return false;
}
}
I tried this which worked.