textbox.onkeydown=function(e) { isNaN(Number(String.fromCharCode((e||window.event).keyCode))) ? return false : return true; }