echo ("<form name=\"form1\" method=\"post\" action=\"c.php\" onsubmit=\"alt(form1.text1.value);\">改为echo ("<form name=\"form1\" method=\"post\" action=\"c.php\" onsubmit=\"return alt(form1.text1.value);\">

解决方案 »

  1.   

    b.php中
     onsubmit=\"alt(form1.text1.value);\">
    改为
     onsubmit=\"return alt(form1.text1.value);\">
      

  2.   

    但是为什么这个有可以呢?可以给我解析一下吗?注意下面的“onsubmit="validateForm();">”<script language="javascript">function isNum (str) {
    var pattern = /(^\d+$)/g;
    if (str.search (pattern) == -1)
    return false;
    else
    return true;
    }function validateForm() { if (document.form1.user_psw.value == "") {
    alert ("Invalid input of password, please try again!");
    return false;
    }
    if (!isNum(document.form1.user_id.value) || document.form1.user_id.value == "") {
    alert ("Invalid input of mobile phone number, please try again!");
    return false;
    }
    document.form1.submit ();
    return true;
    }</script>
    <form name="form1" method="post" action="a.php" onsubmit="validateForm();">
                              <input name="user_psw" type="password" class="input02" id="user_psw" size="13" />
    <input name="user_id" type="text" id="acc_id6" size="13" class="input_tyle"/>
    <span onClick="form1.onsubmit();" style="cursor:hand"><img src="images/index_r5_c5.gif" width="54" height="27"></span>
    </form>