/**
* 只允许输入数字
* @return
*/
function onlyNum() {
var code;
var evt = document.all ? window.event : arguments.callee.caller.arguments[0];
if(document.all){
code = evt.keyCode;
if(!(code<58&&code>47)&&code!=8&&!(code<106&&code>95))
return code.returnValue = false;
}else{
code = evt.which;
if(!(code<58&&code>47)&&code!=8&&!(code<106&&code>95))
evt.preventDefault();
}
}
//添加keydown事件
οnkeydοwn='javascript:return onlyNum();'
浏览器只允许输入数字
最新推荐文章于 2017-02-24 16:01:00 发布