我需要用iframe打开子窗口并在其中发布请求。这里是js代码
function SendPost()
{
var params = "menubar=no,location=no,resizable=yes,scrollbars=yes,status=yes"
var ChildWin= window.open("", "ChildWin", params)
var form = ChildWin.document.createElement("form");
form.setAttribute("method", "post");
form.setAttribute("id", "form");
form.setAttribute("name", "do_post");
form.setAttribute("action", "http://www.javascriptsource.com/");
form.setAttribute("target", "ext_app");
var hiddenField1 = ChildWin.document.createElement("input");
hiddenField1.setAttribute("type", "submit");
//hiddenField1.setAttribute("type", "hidden");
hiddenField1.setAttribute("value", "Submit");
form.appendChild(hiddenField1);
ChildWin.document.body.appendChild(form);
ifrm = ChildWin.document.createElement("iframe");
ifrm.setAttribute("sandbox", "allow-same-origin allow-scripts");
ifrm.setAttribute("id", "ext_app");
ifrm.setAttribute("width", "100%");
ifrm.setAttribute("height", "600");
ifrm.setAttribute("name", "ext_app");
ChildWin.document.body.appendChild(ifrm);
form.submit();
}
在Firefox中,它可以根据需要运行,但在IE中它会再打开一个窗口并在其中发布请求。我不知道为什么会这样,以及如何解决IE的这个问题。真的需要别人的帮助