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 outlook无法配置成功
    • ¥15 Pwm双极模式H桥驱动控制电机
    • ¥30 这是哪个作者做的宝宝起名网站
    • ¥60 版本过低apk如何修改可以兼容新的安卓系统
    • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
    • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
    • ¥50 有数据,怎么用matlab求全要素生产率
    • ¥15 TI的insta-spin例程
    • ¥15 完成下列问题完成下列问题
    • ¥15 C#算法问题, 不知道怎么处理这个数据的转换