//校验输入字符是否为数字类型,调用方法:onkeypress="return isNumbers(event)"
function isNumbers(e)
{
var keynum
var keychar
var numcheck
if(window.event) // IE
{
keynum = e.keyCode
}
else if(e.which) // Netscape/Firefox/Opera
{
keynum = e.which
}
keychar = String.fromCharCode(keynum)
numcheck = /^(0|[1-9]\d*)$/
return numcheck.test(keychar)
}
posted on 2011-01-13 10:31
紫蝶∏飛揚↗ 阅读(417)
评论(0) 编辑 收藏 所属分类:
div+css+js代码