你换成这样吧
<input type="button" value="确定" name="Submit" onclick="check()">

解决方案 »

  1.   

    你的代码,我帮你改好了,照我写的执行,结贴吧!
    <html><head>
    <script language="JavaScript">
    function IsEmpty(str)
    {
      if((str==null)||(str.length==0)) { return true; }
      else { return false; }
    }
      
    function check()
    {

      var NickName=window.document.login_form.NickName.value;
      alert(NickName);
      if(NickName=="")
      { 
       alert("请输入姓名!"); 
       window.document.login_form.NickName.focus(); 
       return false;
      } 
      var PWD=window.document.login_form.PWD.value;
      if(PWD=="")
      { 
       alert("请输入正确登陆密码!");
       window.document.login_form.PWD.focus(); 
       return false;
      }
      return true;    
    }
    </script>
    <meta http-equiv="Content-Language" content="zh-cn">
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <meta name="ProgId" content="FrontPage.Editor.Document">
    <link rel="stylesheet" href="inc/style.css" type="text/css">
    <title>用户登陆</title>
    </head><body><form name="login_form" method="post" action="login.jsp" onsubmit="return check()">
      <input type="text" name="NickName" size="16"><br>
      <input type="password" name="PWD" size="16"><br>
      <input type="submit" value="确定" name="Submit"><input type="reset" value="重写" name="Reset">
    </form></body></html>
      

  2.   

    哦。。有的。sorry,说错了。。
      

  3.   

    onsubmit="javascript:return check()"
      

  4.   

    楼上的对,就是
    onsubmit="javascript:return check()"
      

  5.   

    onSubmit="return check()"//大写"S"
      

  6.   

    你程序Alert的第一个字母不能大写一定要alert,我试过了,改成小写后就可以了
      

  7.   

    onsubmit="javascript: check()"
    这一句没错,不过没就算验证失败也会进入你所指定的页面,所以改成
    onsubmit="return check()"就可以了。
      

  8.   

    faint,这是jsp程序????!!
    我怎么连个<%号都没看到???