为什么我无法在Firefox中提交动态创建的表单 [英] Why can't I submit a dynamically created form in Firefox

查看:75
本文介绍了为什么我无法在Firefox中提交动态创建的表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我拷贝了一个更大的项目的一部分,我没有编写代码,所以我希望有人能帮我找出为什么从这个时尚的js代码发送一个post请求在IE中工作, t在其他浏览器中。

  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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆