日期:2014-05-17  浏览次数:20900 次

求助,为什么onsubmit不执行
JScript code

<script Language="JavaScript">
           function formck(myform1)
     {
         if (myform1.m1.value == "")
         {
            alert("提示:新密码不能为空!");
            myform1.m1.focus();
            return (false);
         } 
         if (myform1.m2.value == "")
         {
            alert("提示:请再次确认新密码!");
            myform1.m2.focus();
            return (false);
         }
         if (myform1.m1.value.length < 6 || myform1.m1.value.length > 15)
         {
            alert("提示:填写6-15位密码!");
            myform1.m1.focus();
            return (false);
         }
         if (myform1.m2.value != myform1.m1.value)
         {
            alert("两次输入密码不同!");
            myform1.2.focus();
            return (false);
         }
         
        return true
    }
</script>
<form action="" method="post" name="myform1" id="myform1" onsubmit="return formck(this)">
    <tr align="left">
      <td height="25" align="left">新密码:</td>
      <td height="25" colspan="2"><input type="password" name="m1" size="20" /></td>
    </tr>
    <tr align="left">
      <td height="25" align="left">确认新密码:</td>
      <td height="25" colspan="2"><input type="password" name="m2" size="20" /></td>
    </tr>
    <tr align="center" valign="top">
      <td colspan="3"><input type="submit" name="Submit" value=" 送出 "/></td>
    </tr>
</form>



------解决方案--------------------
if (myform1.m2.value != myform1.m1.value)
{
alert("两次输入密码不同!");
myform1.2.focus();
return (false);
}
少了个M