Window. close () is used to close the current window. run window in the open window. close () will close the window smoothly, but if it is in a non-window. run window in the open window. close (), a prompt window will pop up, as shown below:
ToProgramIt is also very easy to eliminate this prompt box, but it is slightly different in IE6 and IE7
1. IE6
<HTML xmlns = "http://www.w3.org/1999/xhtml">
<Head runat = "server">
<Title> ie6close </title>
<SCRIPT type = "text/JavaScript">
Function closewin ()
{
Window. Opener = NULL;
Window. Close ();
}
</SCRIPT>
</Head>
<Body>
<Form ID = "form1" runat = "server">
<Div>
<Input id = "btnclose" type = "button" value = "close" onclick = "closewin ()"/>
</Div>
</Form>
</Body>
</Html>
2. IE7
<HTML xmlns = "http://www.w3.org/1999/xhtml">
<Head runat = "server">
<Title> ie7colse </title>
<SCRIPT type = "text/JavaScript">
Function closewin ()
{
Window. Open ('', '_ Self ','');
Window. Close ();
}
</SCRIPT>
</Head>
<Body>
<Form ID = "form1" runat = "server">
<Div>
<Input id = "btnclose" type = "button" value = "close" onclick = "closewin ()"/>
</Div>
</Form>
</Body>
</Html>
This article from the csdn blog, reproduced please indicate the source: http://blog.csdn.net/jame_peng/archive/2009/01/21/3846912.aspx