admin管理员组

文章数量:1287832

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();
}

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();
}
Share Improve this question asked Jul 27, 2010 at 13:15 sekmet64sekmet64 1,6654 gold badges20 silver badges30 bronze badges 0
Add a ment  | 

1 Answer 1

Reset to default 16

Try document.body.appendChild(container) instead.

本文标签: javascriptWhy can39t I submit a dynamically created form in FirefoxStack Overflow