为什么我无法在Firefox中提交动态创建的表单 [英] Why can't I submit a dynamically created form in Firefox
本文介绍了为什么我无法在Firefox中提交动态创建的表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
function f(){
var container = document.createElement(form);
container.method =post;
container.action =http:// localhost:3203 / somefile.aspx;
document.appendChild(container);
container.submit();
解决方案
试试 document.body.appendChild(container)
改为。
I copied a part of a bigger project i'm working on, I didn't wrote the code so I hope someone could help me find out why sending a post request from js code with this fashion works in IE and doesn't in other browsers.
function f() {
var container = document.createElement("form");
container.method = "post";
container.action= "http://localhost:3203/somefile.aspx";
document.appendChild(container);
container.submit();
}
解决方案
Try document.body.appendChild(container)
instead.
这篇关于为什么我无法在Firefox中提交动态创建的表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文