这是一个验证表单的实例,但是没有输入用户名和密码,点提交时,没有弹出警告框,怎么回事啊<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>CheckForm.html</title>
   <script language="javascript">
     function checkForm()
      {
        //定义一个变量
        var theForm=document.test;
        if(theForm.username.value="")
            {
             alert("请输入用户名!");
             theForm.username.focus();
            }
          else if(theForm.pwd.value="")
            {
              alert("请输入密码!");
              theForm.pwd.focus();
            }
            else
              {
                theForm.submit();
              }
              
        }    
       </script>
 
  </head>
  
  <body>
    <form name="test" method="post" action="login.jsp">
                      用户名:<input type="text" name="username"/>
      <br/>
                       密码:<input typt="password" name="pwd"/>
      <br/>
      <input type="button" value="提交"
        onclick="javascript:checkForm()">
   </form>
  </body>
</html>