不能这样用!
在form标签里写:<form onsubmit="return check()">

解决方案 »

  1.   

    <script>
    function check() {

    if(document.login.userName.value=="") {
    alert("用户名不能为空");
    return false;
    }
    if(document.login.password.value=="") {
    alert("密码不能为空");
    return false;
    }
    if(document.login.checkCode.value=="") {
    alert("效验码不能为空");
    return false;
    }
    return true;
    }</script>
    <body>
    <form name=login method=post action="http://192.168.13/test/1.asp">
    用户名:<input type=text name="userName"><br>
    密码:<input type=password name="password"><br>
    校验码:<input type=text name="checkCode"><br>
    <input type=submit value=submit onclick="return check();">
    </form>
    </body>
      

  2.   

    <input type="submit" name="Submit" value="登陆" onClick=return check()>
    改成 type="button"
    函数最后加上 login.submit();
      

  3.   

    <form name="login">
    <input type="button" name="Submit" value="登陆"  method=post  onClick="return check()">
    </form>
    <script language="javascript">
    function check() {
    alert("这里都没有执行");
    if(document.login.name==null||document.login.name=="") {
    alert("用户名不能为空");
    return false;
    }
    if(document.password.name==null||document.password.name=="") {
    alert("密码不能为空");
    return false;
    }
    if(document.check.name==null||document.check.name=="") {
    alert("效验码不能为空");
    return false;
    }
    login.submit();;
    }
    </script>
      

  4.   

    怎样定位到指定的页面?例如next.html,回答了马上结帖。
    怎样定位到指定的页面?例如next.html,回答了马上结帖。
    怎样定位到指定的页面?例如next.html,回答了马上结帖。
    怎样定位到指定的页面?例如next.html,回答了马上结帖。
    怎样定位到指定的页面?例如next.html,回答了马上结帖。
    怎样定位到指定的页面?例如next.html,回答了马上结帖。
    怎样定位到指定的页面?例如next.html,回答了马上结帖。
    怎样定位到指定的页面?例如next.html,回答了马上结帖。
    怎样定位到指定的页面?例如next.html,回答了马上结帖。
    怎样定位到指定的页面?例如next.html,回答了马上结帖。
    怎样定位到指定的页面?例如next.html,回答了马上结帖。
    怎样定位到指定的页面?例如next.html,回答了马上结帖。
      

  5.   

    <script>
    location='next.html';
    </scrpt>