firefox下如何关闭子窗口刷新父窗口? - 技术问答
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了firefox下如何关闭子窗口刷新父窗口? - 技术问答相关的知识,希望对你有一定的参考价值。
第一步:打开模态对话框showModalDialog(\"xxx.html\", window, 0);第二步:刷新父窗口关闭子窗口。我的实现方法是:if(window.dialogArguments)? ?window.dialogArguments.document.URL=window.dialogArguments.location.href;//刷新父窗口else? ?window.location.replace(window.location);window.opener=null;//关闭子窗口window.close();申明的是我的if判断是必须的,是程序其他地方需要。这在IE下没有任何问题,但在火狐下就有问题了,能肯定的是火狐遇到window.dialogArguments和window.dialogArguments.document.URL=window.dialogArguments.location.href这两句话时都会终止,不再执行此后的语句,这个我用alert()语句测试过了,但也不是说火狐不支持dialogArguments,因为我通过alert()输出后是一个[object Window]对象,而IE下是一个[object]对象,现在的问题就是如何可以在火狐下也完成刷新父窗口,关闭子窗口功能。急,谢谢各位大哥大姐帮忙!!!
参考技术A 没人帮忙啊,不过没关系,问题解决了FF下错误是因为window.dialogArguments.document.URL=window.dialogArguments.location.href这句话的缘故,估计FF不支持document的URL属性,所以就错了,我改成下面的就正确了。呵呵window.dialogArguments.document.href=window.dialogArguments.location.href 参考技术B 您好!很高兴为您答疑!火狐不支持document的URL属性,您需要进行修改,火狐下您可以安装Firebug检查页面代码。
您可以在火狐社区了解更多内容。希望我的回答对您有所帮助,如有疑问,欢迎继续在本平台咨询。
在wpf或winform关闭子窗口或对子窗口进行某个操作后刷新父窗口
///弹出窗口
///</summary>
///<param name="sender"></param>
///<param name="e"></param>
privatevoid miFuncSet_Click(object sender, RoutedEventArgs e)
{
WinFuncSetting funcSetting =new WinFuncSetting();
funcSetting.ChangeTextEvent +=new ChangeTextHandler(FuncSettingClosed);
funcSetting.ShowDialog();
}
//设置窗口关闭时执行的方法
void FuncSettingClosed()
{
{
//定义委托
publicdelegatevoid ChangeTextHandler();
///<summary>
/// FuncSetting.xaml 的交互逻辑
///</summary>
publicpartialclass WinFuncSetting : Window
{
publicevent ChangeTextHandler ChangeTextEvent;
public WinFuncSetting()
{
InitializeComponent();
}
privatevoid Window_Closed(object sender, EventArgs e)
{
StrikeEvent();
}
//触发事件改变MainWindow的值
privatevoid StrikeEvent()
{
if (ChangeTextEvent !=null)
{
ChangeTextEvent();
}
}
以上是关于firefox下如何关闭子窗口刷新父窗口? - 技术问答的主要内容,如果未能解决你的问题,请参考以下文章