Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xcode/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Internet explorer 8 Javascript document.form.submit()不适用于Firefox 4.0和IE8_Internet Explorer 8_Firefox4_Javascript - Fatal编程技术网

Internet explorer 8 Javascript document.form.submit()不适用于Firefox 4.0和IE8

Internet explorer 8 Javascript document.form.submit()不适用于Firefox 4.0和IE8,internet-explorer-8,firefox4,javascript,Internet Explorer 8,Firefox4,Javascript,我正在尝试使用javascript提交表单。Firefox3.6可以正常工作,但Firefox4.0和IE8不能正常工作 代码: <table> <tr> <td> <form action='results.html' method='post' target='_blank' id='<% $question->{ QuestionID } %>'> <input ty

我正在尝试使用javascript提交表单。Firefox3.6可以正常工作,但Firefox4.0和IE8不能正常工作

代码:

<table>  
     <tr>
     <td>  
     <form action='results.html' method='post' target='_blank' id='<% $question->{ QuestionID } %>'>  
     <input type='hidden' name='SurveyID' value='<% $surveyid %>'  
     <input type='hidden' name='responses' value='<% join ",", map { $_->{ srid } } @textresults %>'/>  
     <input type='hidden' name='question' value='<% $question->{ QuestionID } %>'/>  
Total Responses: (< a href='javascript: submitForm("<% $question->{ QuestionID } %>");' >View All< /a>)  
     </form>  
     </td>  
     </tr>  
</table>  

Javascript:

<script type='text/javascript'>  
function submitForm(id) {  
document.getElementById(id).submit();  
}  
</script>  

响应总数:(查看所有内容)
Javascript:
函数submitForm(id){
document.getElementById(id.submit();
}  

知道怎么回事吗?

首先,像这样关闭第一个输入标记:
。同时从
a
标记中删除空格,如下:

如果向表单添加name属性并按如下方式提交表单,会发生什么情况:

function submitForm(id) {  
  document.formname.submit();
}

使用
backtick
给出内联代码,
{}
按钮格式化代码,或使用
标记,或在代码前给出enter和enter以及5空格您是否从编辑器复制/粘贴了此代码?顺便说一下,最终tr的格式不正确,它应该是
而不是
javascript:
uri被长期弃用。请使用
onclick
处理程序。实际上,我对stackoverflow还不熟悉。感谢您在格式化代码时提供的有效信息。这取决于他的doctype。。html5不需要关闭的输入标记。@Imondria在添加关闭的输入标记后,在Firefox 4.0和IE8中仍然应该在标记的末尾至少有一个
。非常非常感谢。我有一个问题想问你,在Firefox3.6中没有关闭标签的情况下,它是如何工作的???@Sathyan我想Firefox3.6更能原谅未关闭的标签