<input type=text  onkeypress="return event.keyCode>=65"  style="ime-mode:disabled">

解决方案 »

  1.   

    <input type=text onkeypress="return fun3(event.keyCode)">
    function fun3(key)
    {
    if(key>57||key<48)
    return false;
    else
    return true;
    }
      

  2.   

    <input onkeypress="return event.keyCode>=48&&event.keyCode<=57"
     onpaste="return !clipboardData.getData('text').match(/\D/)"
     ondragenter="return false" style="ime-mode:disabled">
      

  3.   

    <input type=text onkeypress="return event.keyCode>=48&&event.keyCode<=57||(this.value.indexOf('.')<0?event.keyCode==46:false)" onpaste="return !clipboardData.getData('text').match(/\D/)" ondragenter="return false">
      

  4.   

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
    <HEAD>
    <TITLE> New Document </TITLE>
    <META NAME="Generator" CONTENT="EditPlus">
    <META NAME="Author" CONTENT="">
    <META NAME="Keywords" CONTENT="">
    <META NAME="Description" CONTENT="">
    <script>
    function check(obj)
    {
      if(isNaN(obj)){
        alert("不是数字!");
      }
    }
    </script>
    </HEAD><BODY>
    <input type=text name=txt1>
    <input type=button onclick=check(document.all.txt1.value) value="测试">
    </BODY>
    </HTML>
      

  5.   

    var NUM = "0123456789"; 
    function TypeCheck (s, spc)
    {
    var i;
    for(i=0; i< s.length; i++)
    {
    if (spc.indexOf(s.substring(i, i+1)) < 0)
    {
    return false;
    }
    }        
    return true;
    }function CheckInput()        

    if (!TypeCheck(document.Form1.pass.value, NUM))
    {
    alert("只能使用数字. ");
    document.Form1.pass.focus();
    return false;
    }
    document.Form1.submit()
    }