function checkNumber(e) {
var key = window.event ? e.keyCode : e.which;
var keychar = String.fromCharCode(key);
reg = /\d/;
var result = reg.test(keychar);
if(!result){
return false;
}else{
return true;
}
}
<input type="text" style="width:20px;" class="textfield" name="recPerPageStr" value="<%=recPerPageStr%>" maxlength="2" onkeypress="return checkNumber(event);" />
posted on 2007-07-12 16:59
tonywang 阅读(267)
评论(0) 编辑 收藏 所属分类:
javaSctipt