function fstcheck()

temp=form.XXXX.value; for (nIndex=0; nIndex<temp.length; nIndex++)      
{      
cCheck = temp.charAt(nIndex);      
if (!(IsDigit(cCheck)))      
{      
alert("Please input integer in the required number box");      
form.XXXX.focus();      
return false;
}
}
}
function IsDigit(cCheck)      
{      
return (('0'<=cCheck) && (cCheck<='9'));      
}

解决方案 »

  1.   

    <input type=text id=t1 value="">
    <script>
    function toSubmit(){
    var obj=document.getElementById("t1")
    if(parseInt(obj.value)!=obj.value){
      alert("not integer!")
      obj.focus()
      obj.select()
      return false
    }
    }</script>
      

  2.   

    <input onblur="if(this.value!='' && parseInt(this.value)+'dd'!=this.value+'dd') {alert('Error');this.select();this.focus();}" value=0x00>