parseInt("abc")     // Returns NaN.
parseInt("12abc")   // Returns 12.
you should use isNaN to check value of the four input element above first

解决方案 »

  1.   

    这样还不行,
    得用document.form1.T1.value得到值。
    另给form加上name属性。
      

  2.   

    how to check in this sample , can u tell me ! thx,my dear friend,cuz
     I am a caibird in JavaScript.
      

  3.   

    给form加name就是这样:
    <form method="POST" onsubmit="return check();" action="bb1.jsp" name="form1">
    在你的Javascript中使用form1来指定form元素:
    if (parseInt(form1.T1.value)!= parseInt(form1.T2.value)+parseInt(form1.T3.value)+parseInt(form1.T4.value))
      

  4.   

    <script language="JavaScript">
      function check()
    {
      if (parseInt(form1.T1.value)!= parseInt(form1.T2.value)+parseInt(form1.T3.value)+parseInt(form1.T4.value))
     {
      alert("bu相等!");
      return false;
      }
      return true;
    }
    </script>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>New Page 1</title>
    </head>
    <body>
    <form name=form1 method="POST" onsubmit="return check();" action="bb1.jsp">
    <p><input type="submit" value="提交" name="B1" ><input type="reset" value="全部重写" name="B2"><input type="text" name="T1" size="20"><input type="text" name="T2" size="20"><input type="text" name="T3" size="20"><input type="text" name="T4" size="20"></p>
    </form>
    </body>
    </html>
      

  5.   

    <script language="JavaScript">
    function check() {
    var obj=document.forms[0];
    if (eval(obj.T1.value)!= eval(obj.T2.value) + eval(obj.T3.value) + eval(obj.T4.value)) {
    alert("bu相等!");
    return false;
    }
    return true;
    }
    </script>