父窗口JS:
<script language="javascript" type="text/javascript">
function openwin(){
var width=Math.round((window.screen.width-600)/2);
var height = Math.round((window.screen.height - 300) / 2);
var returnValue = window.showModalDialog("test.aspx', window, 'dialogWidth:600px;dialogHeight:300px, top=' + height + ',left=' + width + ',toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no')
if (returnValue == 'ok')
window.top.location.reload();
}
</script>
test.aspx中<head>与</head>之间加上:
<base target="_self">
test.aspx.cs中:
Response.Write("<script language='javascript' type='text/javascript'>
window.returnValue = 'ok';window.close();
</script>");
怎样将弹出的模式窗口关闭并刷新父窗体?
最新推荐文章于 2024-04-25 16:34:32 发布
本文介绍了一种使用JavaScript实现父窗口刷新的方法,并展示了如何通过弹窗(模态对话框)传递返回值到父窗口的具体实现。代码示例包括了父窗口打开子窗口、设置弹窗位置、子窗口返回值以及根据返回值刷新父窗口的完整流程。
384

被折叠的 条评论
为什么被折叠?



