改了一下,你看看<html>
<head>
<script language="JavaScript">
<!-- Hidefunction test1() {
  var flag=true;
  if ((first.uid.value == "")||(first.uid.value.length()==0))
    {
    alert("请 输 入 您 的 ID!")
    window.document.first.uid.focus();
    flag=false;
    }
  else if ((first.pwd.value == "")||(first.pwd.value.length()==0))
    {
    alert("请 输 入 您 的 pw!")
    window.document.first.pwd.focus();
    flag=false;
    }
   return flag;
}// -->
</script>
</head><body>
<form name="first" action="viewRes.do" method="post">
<div align="center"><b><font size="3">请具实填写下列申请单 </font> </b>
<hr width="100%">
<table>
  <tr>
  <td><div align="right">请选择一个用户ID:</div></td>
  <td><input type="text" name="uid"></td>
  </tr>
  <tr>
  <td><div align="right">请输入您的密码:</div></td>
  <td><input type="password" name="pwd"></td>
  </tr>
</table>
<hr width="100%">
<div align="center">  <input type="submit" name="button1" value=" 确 定 " onClick="return test1();">
                      <input type="reset" name="reset" value=" 清 除 ">
</div>
</form>
</html>

解决方案 »

  1.   

    learnner(&nbsp;)
    试过了没用 !
    还是原来的情况
      

  2.   

    我做了修改,你试一下,我的项目的登陆验证就是这样的
    <html>
    <head>
    <script language="JavaScript">
    <!-- Hidefunction test1() {
      var flag=true;
      if (document.first.uid.value == "")
        {
        alert("&Ccedil;&euml; &Ecirc;&auml; &Egrave;&euml; &Auml;ú &micro;&Auml; ID!")
        document.first.uid.focus();
        flag=false;
        }
      else if (document.first.pwd.value == "")
        {
        alert("&Ccedil;&euml; &Ecirc;&auml; &Egrave;&euml; &Auml;ú &micro;&Auml; pw!")
        document.first.pwd.focus();
        flag=false;
        }
       return flag;
    }// -->
    </script>
    </head><body>
    <form name="first" action="viewRes.do" method="post">
    <div align="center"><b><font size="3">&Ccedil;&euml;&frac34;&szlig;&Ecirc;&micro;&Igrave;&icirc;&ETH;&acute;&Iuml;&Acirc;&Aacute;&ETH;&Eacute;ê&Ccedil;&euml;&micro;&yen; </font> </b>
    <hr width="100%">
    <table>
      <tr>
      <td><div align="right">&Ccedil;&euml;&Ntilde;&iexcl;&Ocirc;&ntilde;&Ograve;&raquo;&cedil;&ouml;&Oacute;&Atilde;&raquo;§ID:</div></td>
      <td><input type="text" name="uid"></td>
      </tr>
      <tr>
      <td><div align="right">&Ccedil;&euml;&Ecirc;&auml;&Egrave;&euml;&Auml;ú&micro;&Auml;&Atilde;&Uuml;&Acirc;&euml;:</div></td>
      <td><input type="password" name="pwd"></td>
      </tr>
    </table>
    <hr width="100%">
    <div align="center">  <input type="submit" name="button1" value=" &Egrave;· &para;¨ " onClick="return test1();">
                          <input type="reset" name="reset" value=" &Ccedil;&aring; &sup3;&yacute; ">
    </div>
    </form>
    </html>