Closing of a small (or child ) window On click of button
A child window can be closed after displaying some information or taking some inputs from the user. The window can be self closed or can be closed by clicking a button or a link inside it.
Passing data & Managing Parent - Child window
To know on how to open a child or small window you can refer to our tutorial here. You can take the input from user and automatically close the window depending on the requirements. Even you can refresh the parent window while before closing the main window.
self closing window
Here are the commands for closing the child window ( from the child window).
<input type=button onClick="self.close();" value="Close this window">
Closing open window
demo of Opening and closing child window
To close and open window from the parent window we have to use this code( parent.htm).
The code of child.htm window is here
<title>(Type a title for your page here)</title>
<input type="button" name="btn" value="Open" onclick="to_open()";>
<input type="button" name="btn" value="Close" onclick="to_close()";>
Window object Reference Passing data from Child window to parent window
Window onload to execute code
<title>Demo of child window</title>
This is child window
This article is written by plus2net.com team.