document.form.submit();不适用于MAC中的Safari 10.0.3浏览器,但它正在运行Safari 5 Windows版本和所有其他浏览器

时间:2017-03-10 06:10:52

标签: javascript browser safari form-submit document

document.form.submit();无效 MAC 中的 Safari 10.0.3 浏览器,但它正在运行Safari 5 Windows版本和所有其他浏览器。

已创建其表单对象但未提交。

HTML file ======
<html>
<head>
    <META HTTP-EQUIV="Cache-Control" CONTENT="no-store, must-revalidate"></META>
    <META HTTP-EQUIV="expires" CONTENT="-1"></META>
    <META HTTP-EQUIV="Pragma" CONTENT="no-cache"></META>
    <title><xsl:value-of select="res:getString($ISO, 'Mileage1284')"/></title>
    <link rel="STYLESHEET" type="text/css"><xsl:attribute name="href"><xsl:value-of select='$CSS'/></xsl:attribute></link>
    <script type="text/javascript"><xsl:attribute name="SRC">/Resources/Jscript/<xsl:value-of select='$ISO'/>/Common/ErrorStrings.js</xsl:attribute></script>
    <script type="text/javascript" src="/Resources/Calendar/DatePicker.js"></script>        
    <script type="text/javascript" src="/Resources/Jscript/Claims/OOPxsl.js"></script>  
    <script type="text/javascript" src="/Resources/Jscript/Common/preventClick.js"></script>        
</head>
<body leftmargin="2" topmargin="2" onload="CalcDistAmount(); setBillable(); ">
<!--<xsl:attribute name="onload"></xsl:attribute>-->
<form name="AddEXPForm" action="/dcal/ClaimsServlet" method="post" TARGET="iframe9">
<input type="hidden" name="action" value="editMileDetails"/>
<!-- Start:  Added CSRF token for EditMileDetails  -->
<input type= "hidden">
  <xsl:attribute name="name"><xsl:value-of select="//Root/DCalApp/CSRF_PARAMETER_NAME"/></xsl:attribute>
  <xsl:attribute name="value"><xsl:value-of select="//Root/DCalApp/CSRF_PARAMETER_VALUE"/></xsl:attribute>
</input>
<!-- End  -->
<input type="hidden" name="commaStyle" value="N"/>
<input type="hidden" name="claimIndex"><xsl:attribute name="VALUE"><xsl:value-of select='//Root/DCalApp/claimIndex'/></xsl:attribute></input>
<input type="hidden" name="claimID"><xsl:attribute name="VALUE"><xsl:value-of select='//Root/claimID'/></xsl:attribute></input>
<input type="hidden" name="CardID"><xsl:attribute name="VALUE"><xsl:value-of select='//Root/CardID'/></xsl:attribute></input>


<!--Button table-->

<table width="479" border="0" cellspacing="0" cellpadding="0">
    <tr>
        <td><img src="/Resources/images/sp.gif" width="1" height="5" alt="" border="0"/></td>
    </tr>
    <tr>
        <td class="tablebgcolorlist"><img src="/Resources/images/sp.gif" width="1" height="1" alt="" border="0"/></td>
    </tr>
    <tr>
        <td><img src="/Resources/images/sp.gif" width="1" height="3" alt="" border="0"/></td>
    </tr>
    <tr>
        <td height="30" align="center" class="buttonbarbg">
            <table border="0" cellspacing="0" cellpadding="0">
                <tr>
                    <td>
                    <input type="button" class="submit" onClick="doSubmit()">
   <xsl:attribute name="value">
      <xsl:value-of select="res:getString($ISO, 'Submit1793')"/>
   </xsl:attribute>
</input><xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text> 
                    <input type="button" class="submit"  onClick="window.close()">
   <xsl:attribute name="value">
      <xsl:value-of select="res:getString($ISO, 'Close638')"/>
   </xsl:attribute>
</input><xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text> 
                    </td>
                </tr>
            </table>
        </td>
    </tr>
</table>

<!--End of Button table-->

<!--bottom curve table-->



<!--end of bottom curve table-->
</form>
</body>
</html>

在Javasciprt文件中=======

  function doSubmit(){
 // called on click of submit button
  document.AddEXPForm.submit();
   window.close();  
 }

感谢您的帮助谢谢!!

2 个答案:

答案 0 :(得分:0)

答案 1 :(得分:0)

请改用此方法(将[0]添加到您的AddEXPForm表单中):

  function doSubmit(){
 // called on click of submit button
  document.AddEXPForm[0].submit();
   window.close();  
 }