Refresh parent window from child window without having to press the refresh button
2008-04-14 10:50
483 查看
Ref: http://www.dotnetjunkies.com/WebLog/dinakar/articles/12379.aspx
Heres a small piece of code to force refresh the parent window from the child window after closing the child window, without having to press the refresh button.window.opener.location=window.opener.location; window.close();
.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, "Courier New", courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }
response.write the above JS code in the child window.
for example:
response.write(”<Script> window.opener...........close();" & Chr(60) & "/script >")
If you want the user to manually refresh the page after closing the child window use
window.opener.location.reload();window.close();
.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, "Courier New", courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }
in the above example.
If you just want to close the child window ( as in “cancel”) use window.close(); in the above example.
相关文章推荐
- 子页面关闭时传值给父页面(pass value from child window to parent window, when the child window is closing)
- I do not want to inherit the child opacity from the parent in CSS(不想让子元素继承父元素的透明度)
- Refresh a GridView control on the parent page, from a pop up window
- How to pass value from Child window to Parent Window
- Pass value from child popup window to parent page window using JavaScript--reference
- IE 8 HTML Parsing Error:Unable to modify the parent container element before the child element is cl
- Message: HTML Parsing Error: Unable to modify the parent container element before the child element is closed (KB927917)
- javascript错误解决:Unable to modify the parent container element before the child element is closed
- string - How to get the filename without the extension from a path in Python? - Stack Overflow
- Siebel Tools: How To Invoke Script from a Siebel Button At the Business Component and Applet Levels
- How to get the data from a cell when I click on the GridButtonColumn of the same row
- LR:接口性能测试时提示:Code-29723 Error: Failed to deliver a p2p message from parent to child process, reason
- How to (how to refresh/redirect the contents of one frame from another frame )
- IE8 下 HTML Parsing Error: Unable to modify the parent container element before the child element is closed (KB927917)
- IE 8 HTML Parsing Error:Unable to modify the parent container element before the child element is cl
- Heroku上部署了app,出现You're using the staticfiles app without having set the STATIC_ROOT setting to。。。错误
- Failed to read the 'localStorage' property from 'Window' 的解决办法
- 转SSIS 2012 pass values from child package to parent with project deployment model
- javascript错误解决:Unable to modify the parent container element before the child element is closed
- HTML Parsing Error:Unable to modify the parent container element before the child element is closed