把函数名改为其他名称,name已被javascript用做属性使用(Error.name)

解决方案 »

  1.   

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <html>
    <head>
    <script language="javascript" type="">
    function ifNULL(){
     if(form1.textID.value == ""){
     alert("用户名怎么可以为空?");
     form1.textID.focus(); 
      }
    }
    </script>
    </head><body>
    <form name="form1" method="post" action="">
      <table width="550" border="0" align="center">
        <tr>
          <td width="82">用户名:</td>
          <td width="458"><input type="text"  onMouseOver="ifNULL()" name="textID"></td>
        </tr>
        <tr>
          <td>密码:</td>
          <td><input type="text" name="textfield2"></td>
        </tr>
        <tr>
          <td colspan="2"><div align="center">
            <input type="button" name="button" value="按钮" onclick="name()">   
                     
                  <input type="reset" name="Submit2" value="重置">
          </div></td>
        </tr>
      </table>
    </form>
    </body>
    </html>