提交不是js中的函数

Ans*_*hul 3 html javascript firefox internet-explorer struts2

我有一个struts 2表单标签,我试图使用java脚本函数提交表单.但是当我尝试这样做时,我收到以下错误.

"document.testForm.submit is not a function" IE 8(Object doesn't support this property or method)
Run Code Online (Sandbox Code Playgroud)

这是我的java脚本函数和html代码: -

<script type="text/javascript">
        function testFunction()
        {
          document.testForm.action = "testAction";
           document.testForm.submit();

        }
</script>

<s:form method="POST"  id="fileForm" name="testForm"
    enctype="multipart/form-data">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
       <tbody>
        <tr>
           <td>
             <input type="button" name="submit" value="Upload File"    onclick="testFunction();"/>
           </td>
            </tr>
       </tbody>
   </table>
</s:form>
Run Code Online (Sandbox Code Playgroud)

我正在使用FF 7和IE 8

请帮帮我.

T.J*_*der 22

问题是您已将提交按钮命名为"提交":

<input type="button" name="submit" ...>
<!--                 ^^^^^^^^^^^^^  -->
Run Code Online (Sandbox Code Playgroud)

将其更改为其他任何内容.表单元素使用它们的名称作为属性添加到表单对象,以便阴影(覆盖)表单的内置submit属性(这是您正在寻找的功能).