cmdll88 2017-11-21 09:47 采纳率: 100%
浏览 680

求助!ShowModalDialog IE9

function ShowModalDialog(win,url,a) {

var iframe = document.getElementById("postiframe");

if (!iframe) {

iframe = document.createElement("iframe");

iframe.id = "postiframe";

iframe.name = "postiframe";

iframe.frameborder = "0";

iframe.style.width = "500px";

iframe.style.height = "400px";

}

var myForm = document.createElement("form");

myForm.id = "formtosubmit";

myForm.method = "post"; //使用post方式提交

myForm.action = url+"&isDlg=1"; //以dialog方式打开

myForm.target =iframe.id;

var aInput = document.createElement("input");

aInput.name = "a";

aInput.value = a; //将值赋予这个隐藏的field

var submitInput = document.createElement("input");

submitInput.setAttribute('type', "submit");

myForm.appendChild(aInput);

myForm.appendChild(submitInput);

document.body.appendChild(myForm);

/*var config = {
title: "录入信息",
dialogWidth: 650,
dialogHeight: 450,
maximizable: true,
max: true,
minimizable: true
};*/
var options = {

//url: url,

html:iframe,

title: "",

dialogWidth: 650,
dialogHeight: 450,
maximizable: true,
max: true,
minimizable: true
/*,

dialogReturnValueCallback: DialogCallback */
};

win.showModalDialog(options);
myForm.submit();

document.body.removeChild(myForm);

}

调用代码:
var url = "www.baidu.com";
var win = new ModalDialogWindow();
ShowModalDialog(win,url,a);

结果:1、浏览器新窗口中打开一页面(内容与预期相同)
2、原window中还有一窗口(内容为空 )
预期:不从1窗口中打开 内容在2窗口中展示!图片说明

共有三级窗口 我将 myForm.target =iframe.id; 改为 myForm.target =“_self”; 可以在2窗口中展示 但覆盖了二级窗口 关 闭或返回时跳到第一级页面去了

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 c程序不知道为什么得不到结果
    • ¥40 复杂的限制性的商函数处理
    • ¥15 程序不包含适用于入口点的静态Main方法
    • ¥15 素材场景中光线烘焙后灯光失效
    • ¥15 请教一下各位,为什么我这个没有实现模拟点击
    • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
    • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
    • ¥20 有关区间dp的问题求解
    • ¥15 多电路系统共用电源的串扰问题
    • ¥15 slam rangenet++配置