利用VBScript中的"MOD"进行判断
result = number1 Mod number2

解决方案 »

  1.   

    <Input type="text" name="aaa" onBlur="ValidateIt(value)" />
    <script language="vbscript">
        sub ValidateIt(val1)
            if val1 mod 2 <> 0 then
                msgbox "It is a odd!"
            end if
        end sub
    </script>
      

  2.   

    function youfuncton(number)
    {
      if ( number %2 ==1)
         {alert("奇数");}
      else
         {alert("偶数");}
    }
      

  3.   

    还需要增加判断value是否为数字的功能
      

  4.   

    数能帮我限制输入框内不为负数和零,我现在已经限制为只输入数字了,但负数和零不能去掉,我的是这样子的:
    <input type="text" name="aaa"  onKeyPress="if (event.keyCode < 45 || event.keyCode > 57) event.returnValue = false;">
      

  5.   

    onblue="f0(value)"<script>
        f0(val1)
        {
             if (val1 <= 0)
                 alert("aaaaa");
        }</script>