<HTML>
<HEAD>
<TITLE> New Document </TITLE></HEAD>
<script>
String.prototype.isInteger=function(){
return !isNaN(Number(this)) && this.indexOf(".")==-1 ;
}function chk(el){
if(!el.value.isInteger()){
alert("please input number!");
el.value = el.value.substr(0,(el.value.length-1));
}
}
</script>
<BODY>
<input type=text id=tt onkeyup="chk(this)">
</BODY>
</HTML>
<HEAD>
<TITLE> New Document </TITLE></HEAD>
<script>
String.prototype.isInteger=function(){
return !isNaN(Number(this)) && this.indexOf(".")==-1 ;
}function chk(el){
if(!el.value.isInteger()){
alert("please input number!");
el.value = el.value.substr(0,(el.value.length-1));
}
}
</script>
<BODY>
<input type=text id=tt onkeyup="chk(this)">
</BODY>
</HTML>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货