FF下多个表单的提交问题
<script type="text/javascript">
function SubmitData(){
var tform1= document.getElementById("myForm1");
tform1.submit();
var tform2= document.getElementById("MyForm3");
tform2.submit();
}
</script>
<form action="test2.php" method="post" id="myForm1">
Input A1:<input id="A1" name="A1" type="text"><br/>
</form><br/>
<form action="test.php" method="post" id="MyForm2">
Input B1:<input id="B1" name="B1" type="text">
<input type="button" id="btn_submit" name="btn_submit" value="提交" onclick="return SubmitData();">
</form>
为什么总是只提交myForm2的,不提交MyForm1的?
------解决方案--------------------因为只能提交一个,提交2个可以考虑异步
------解决方案--------------------页面插入一段隐藏的div 控制表单提交
<div style="display:none;">
<iframe name="form1target"></iframe>
<iframe name="form2target"></iframe>
</div>
然后将代码改下
function SubmitData(){
var tform1= document.getElementById("myForm1");
tform1.target="form1target";
tform1.submit();
var tform2= document.getElementById("MyForm3");
tform2.target="form2target";
tform2.submit();
}