标签:
<input type="number" id="myid"/>
<script>
var parentValue;
var myid=document.getElementById("myid");
myid.onkeyup=function(e){
var keyCode=e.keyCode;
var value=this.value;
if(!value){
value=(keyCode==8)?"":parentValue;
}else{
//正则
}
parentValue=value;
myid.value=value;
alert(this.value);
}
</script>
标签:
原文地址:http://www.cnblogs.com/hcw136156133/p/5031560.html