C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Interview   Jobs   Projects   Offshore Development    
Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing | Talk to Us |



My Profile

Gifts

Active Members
TodayLast 7 Days more...









Refresh Parent page when Child window closes


Posted Date: 16 Jul 2008    Resource Type: Code Snippets    Category: Javascript

Posted By: Kundan Kumar Sinha       Member Level: Gold
Rating:     Points: 7



The code sample contains code for two HTML pages - parent and child. We aim to call a child page from the parent by using Javascript functions and refresh the parent page when the child window is closed.

The code for refreshing is contained in the child page.

Code for the parent page Main.html is next:



<html>
<head>
<title>Main Window</title>
<script Language = "JavaScript">
function OpenWin()
{
window.open("Child.html", "Child",'width=300,height=200,left=150,top=100,scrollbar=no,resize=no');

}
</script>
</head>
<body>
<h4>Click the button to open a new window.</h4>
<input type="button" value="Click Me" onclick="OpenWin();"></br>

</body>
</html>




Save the followin code as Child.html



<head>
<title>Child Window</title>
<script Language = "JavaScript">
function CloseWin()
{
window.close();
opener.location.reload();
}
</script>
</head>
<body>
<h4>Click the button to close the window.</h4>
<input type="button" value="Click Me" onclick="CloseWin();">
</body>
</html>





Responses

Author: Shankar    17 Jul 2008Member Level: Gold   Points : 1
Hi

You can also use "window.opener" for accessing the parent page.

Thanks
A S


Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Refresh Parent page when Child closes  .  Refresh Parent page on Child window close  .  Refresh Parent page  .  Refresh HTML page  .  Open Child window from parent  .  Open Child in a new Window from parent HTML  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Run exe file using Java Script
Previous Resource: Customized Circling 3D Text in the Browser
Return to Discussion Resource Index
Post New Resource
Category: Javascript


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design

doors in nj

Contact Us    Privacy Policy    Terms Of Use