【发布时间】:2014-12-18 07:18:15
【问题描述】:
我正在开发一个使用许多模式对话框来获取输入的 Web 应用程序。当我开始使应用程序与 IE11 兼容时,问题就开始了(它在 IE8 中运行良好)。当从主页调用时,模态对话框完美地返回值,但是当我从模态对话框创建模态对话框时,该值被返回但未被捕获并被视为undefined。
//calling the values
var ret = ShowDialogOpen(pageUrl, width, height);
function ShowDialogOpen(PageName, strWidth, strHeight) {
var DialogOptions = "Center=Yes; Scrollbar=No; dialogWidth=" + strWidth + "; dialogTop=150px; dialogHeight=" + strHeight + "; Help=No; Status=No; Resizable=Yes;";
var OpenUrl = PageName;
var ret = window.showModalDialog(OpenUrl, "Yes", DialogOptions);
return ret;
}
//Dialog returning values
function ReturnValues() {
var lstBox = document.getElementById("lst_Name");
var texts = "";
var values = "";
for (i=0; i<lstBox.options.length; i++) {
texts = texts + lstBox.options[i].text + "!";
values = values + lstBox.options[i].value + "!";
}
window.returnValue = texts + "$" + values;
Close();
return false;
}
此代码在通过主页使用时可以完美运行,但是当我从模式对话框页面使用它时,returnValue 会丢失。
【问题讨论】:
-
关闭();是函数
标签: javascript internet-explorer-8 nested internet-explorer-11 showmodaldialog