Javascript 为什么我的window.dialogArguments未定义
我需要在模式对话框中打开一个.aspx页面。下面是我用来打开对话框的JS代码:Javascript 为什么我的window.dialogArguments未定义,javascript,asp.net,modal-dialog,Javascript,Asp.net,Modal Dialog,我需要在模式对话框中打开一个.aspx页面。下面是我用来打开对话框的JS代码: if (url) { var fullPath = url + "/Validation.aspx"; } else { alert("Could not find the location of the merge dialog. Please contact your System admin and have th
if (url) {
var fullPath = url + "/Validation.aspx";
}
else {
alert("Could not find the location of the merge dialog. Please contact your System admin and have them update the configuration entity.");
return;
}
var features = "unadorned:yes;scroll:yes;resizable:yes;status:yes;dialogHeight:480px;dialogWidth:480px;";
var args = {
selected: selectedIds,
page: pageIds,
fetchXml: xml,
entity: "xyz"
};
window.showModalDialog(fullPath, args, features);
在我的validation.aspx页面中,我需要能够获取JS参数,将它们分配到隐藏字段,然后重新发布,这样我就可以在服务器端使用这些参数值
以下是我的.aspx页面中的JS代码:
window.onload = function(){
if (!window.dialogArguments)
return;
var args = window.dialogArguments;
...
}
我在网络上看到了大量这样的例子但是…我的window.dialogArguments在我的.aspx页面中始终未定义。有什么好处?有人有什么想法或解决方案吗?我的假设是,正在跨域打开ASPX对话框页面 这意味着您的父页面位于一个域aka:
http://abc/page.html
,并且您的子对话框页面位于另一个域中,如:http://def/dialog.html
如果是这种情况,似乎对访问dialogArguments和returnValue有限制。例如,查看上的注释。ps:这是我在.aspx页面中的JS代码:当您尝试运行该代码时,会发生什么情况?代码片段位于文档头的底部…?aspx页面中的JS位于标题中。window.dialogArguments未定义,因此它只是从window.onload函数中返回。