如何解决关闭ShowModalDialog时,重定向父窗体
| 使用ѭ0关闭模态对话框时,如何将主页重定向到另一个网页? 我在这里有关闭表单的代码:function Msg()
{
parent.window.opener.location.href = \'MyRequirements.aspx\';
window.close();
}
这是我打开模式对话框的代码:
function Go()
{
var model= document.getElementById(\"cboModel\").value;
var variant= document.getElementById(\"cboVariant\").value;
var color = document.getElementById(\"cboColor\").value;
var code = document.getElementById(\"txtCode\").value;
window.showModalDialog(\"MesgeBox.aspx?model=\" + model +
\"&variant=\" + variant + \"&color=\" + color + \"&code=\" + code +
\"\",\"\",\"dialogHeight: 100px; dialogWidth: 80px; edge: Raised;help: No; resizable: No; status: No; center: Yes; scrollbars: No;\")
}
opener.location
不起作用。
解决方法
自从我使用showModalDialog以来已经有很长时间了,但是假设您要重定向到的URL是可变的,并且需要从子模式对话框中设置,我认为这样应该可以:
// Msg() is on child dialog
function Msg() {
window.returnValue = \'MyRequirements.aspx\';
window.close();
}
// Go() is on parent window
function Go() {
// your intialisation
var newLocation = window.showModalDialog(/*your params*/);
if (newLocation != \"\")
window.location.href = newLocation;
}
有关更多信息,请参见online5ѭ和showModalDialog()
的在线doco。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。