<input onkeyup="if(event.keyCode==38) value++;if(event.keyCode==40) value--;" value=0>

解决方案 »

  1.   

    <script>
    var  timer=null;
    function check(uid)
    {
    var obj=document.all(uid);
    if(isNaN(obj.value))obj.value=obj.value.slice(0,-1)
    timer=setTimeout("check('"+uid+"')",10);
    }
    function myclear(){
    clearTimeout(timer)
    }
    function set(i)
    {
    if(i==1)
    document.all.mytext.value++;
    else
    document.all.mytext.value--;
    }
    </script>
    <form name=form1>
    <input name=mytext onfocus=check(this.uniqueID) onblur=myclear()>
    <input type=button value="+" onclick=set(1)>
    <input type=button value="-" onclick=set(0)>
    输入过程中即时检查文本框
    </form>
      

  2.   

    <input onkeyup="if(event.keyCode==38) value++;if(event.keyCode==40) value--;"onkeypress="if(event.keyCode<48||event.keyCode>57)return false">
      

  3.   

    <style>
    .navPoint {
    font-family: Webdings;
    font-size:9px;
    cursor:hand;
    height:10px;
    }
    </style><table CELLPADDING='0' CELLSPACING='0'>
    <tr>
    <td rowspan=2><input type=text value=0 id="spinner"></td>
    <td><input type=button class="navPoint" value="5" onClick="spinner.value++"></td>
    </tr>
    <tr><td><input type=button class="navPoint" value="6" onClick="spinner.value--"></td>
    </tr>
    </table>
      

  4.   

    可以了
    <style>
    .navPoint {
    font-family: Webdings;
    font-size:7px;
    cursor:hand;
    height:10px;
    width:20px;
    background-color:#C0C0C0;
    border:1 outset #ffffff;
    }
    </style><table CELLPADDING='0' CELLSPACING='0'>
    <tr>
    <td rowspan=2><input type=text value=0 id="spinner"></td>
    <td><input type=button class="navPoint" value="5" onClick="spinner.value++"></td>
    </tr>
    <tr><td><input type=button class="navPoint" value="6" onClick="spinner.value--"></td>
    </tr>
    </table>