刚才发错了,
function check_form($obj)
{
if($obj.name.value.length<6)
{ alert('name 6++');
return false;
}
return true;
}
问题依旧

解决方案 »

  1.   

    把 action 去掉,在验证函数通过后,再跳转吧
      

  2.   

    function check_form($obj)
    {
    if($obj.name.value.length<6)//加一个length
    { alert('name 6++');
    return false;
    }
    return true;
    }
    另外<form name="form1" method="post" action="http://www.163.com" onSubmit="check_form(this)">
    -》<form name="form1" method="post" action="http://www.163.com" onSubmit="return check_form(this);">
      

  3.   

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=shift_jis">
    <title>Untitled Document</title>
    <script language="javascript">
    function check_form($obj)
    {
    //alert($obj.name.value.length);
    var toInt = parseInt($obj.name.value.length);
    //alert(toInt);
    if(toInt<6){ 
    alert('name 6++');
    return false;
    }else{
    $obj.submit();
    }

    }
    </script>
    </head><body>
    <form name="form1" method="post" action="#" >
      <p>
        <input name="name" type="text" id="name">
    </p>
      <p>&nbsp;</p>
      <p>
        <input type="text" name="textfield">
      </p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>
        <input type="button" name="Submit" value="Submit" onClick="check_form(form1)">
                  </p>
    </form>
    </body>
    </html>