SQL PHP HTML ASP JavaScript articles and free scripts to download
JavaScript Window Object

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. 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).
<html>
<head>
<title>(Type a title for your page here)</title>
<script language=javascript>

function to_open(){
tm=window.open("child.htm","Ratting","width=550,height=170,0,top=260,status=0,");
}

function to_close(){
tm.close();
}


</script>
</head>

<body>

<input type="button" name="btn" value="Open" onclick="to_open()";>
<input type="button" name="btn" value="Close" onclick="to_close()";>

</body>
</html>
The code of child.htm window is here
<html>

<head>
<title>Demo of child window</title>
</head>

<body>
This is child window


</body>

</html>

Google+

Post Comment This is for short comments only. Use the forum for more discussions.
Name
Email( not to be displayed)Privacy Policy
1+2=This is to prevent automatic submission by spammers. Please enter the result of the sum as asked




Join Our Email List
Email:  
For Email Newsletters you can trust
HTML . MySQL. PHP. JavaScript. ASP. Photoshop. Articles. FORUM Contact us

©2000-2014 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer