window.showModalDialog关闭子页面刷新父页面
2010-07-21 09:45
309 查看
这个问题的解决方案有不少,但有些方法总会出问题,下面提一个终极解决办法做参考
思路:在父页面提交一个LinkButton按钮,让其隐藏,关闭子页面的时候让LinkButton onclick事件重新刷新页面。首先在父页面添加一个LinkButton让其text为空,那么就可以隐藏LinkButton,然后注册这个按钮的js,LinkButton.Attributes.Add("onfocus", "javascript:__doPostBack('btnFresh','');");
添加一段JS代码
var sReturn=window.showModalDialog("" + id,'','dialogWidth:420px;dialogHeight:570px,center=yes,status=no,resizable=no,scroll=no,dialogHide=on');;
if (typeof(sReturn) != "undefined")
{
if (sReturn=="1")
{
document.all["btnFresh"].focus();
}
}
然后在子页面提价一下JS代码
function reload()
{
window.parent.returnValue='1';window.close();
}
因为是showModalDialog 所以记住加入 <base target="_self"/>
00(请您对文章做出评价) //打开模式窗口var id= $("cbH").value;
var num=$("numH").value;
htmUrl=htmUrl+"?id="+id+"&num="+num;
var Width="450";
var Height="200";
var arguemnts = new Object();
arguemnts.window = window;
if (document.all&&window.print)
{
window.showModalDialog(htmUrl,arguemnts,"dialogWidth:" + Width + "px;dialogHeight:" + Height + "px;center:yes;status:no;scroll:yes;help:no;");
window.location.reload();
}
else
{
window.open(htmUrl,"","width=" + Width + "px,height=" + Height + "px,resizable=1,scrollbars=1");
} //关闭模式窗口 function closedialogwindow()
{
window.dialogArguments.window.location = window.dialogArguments.window.location;
self.close(); }
相关文章推荐
- window.showModalDialog关闭子页面刷新父页面
- window.showModalDialog 关闭当前页面刷新父页面
- window.showModalDialog关闭子页面刷新父页面
- window.open打开的窗口关闭后刷新父页面的子页面
- window.showModalDialog方式/模式窗口数据不刷新(缓存)问题/模式窗口中,链接弹出新窗口问题/无提示关闭页面的方法
- 关于 window.showModalDialog()弹出框刷新父页面的问题
- window.showModalDialog刷新父页面的问题
- ShowModalDialog关闭后刷新父页面
- 框架里的main.aspx利用showModalDialog打开子页面B,B页面点确定后关闭自己并局部刷新父页面main.aspx的方法
- window.showModalDialog和window.open关闭子页面时刷新父页面
- window.showModalDialog和window.open关闭子页面时刷新父页面
- window.parent与window.opener、window.showModalDialog的区别 opener和showModalDialog刷新父页面的方法
- window.open页面关闭后刷新父页面
- window.showModalDialog和window.open关闭子页面时刷新父页面
- window.open页面关闭后刷新父页面
- 如何在window.showModalDialog提交请求后关闭本窗口并刷新父窗口
- window.open页面关闭后刷新父页面
- window.showModalDialog()弹出页面的关闭问题
- window.showModalDialog和window.open关闭子页面时刷新父页面【转】
- window.parent与window.opener、window.showModalDialog的区别 opener和showModalDialog刷新父页面的方法