If the webpage is not opened through a script program (window. open (), call window. before closing the window, you must close the window. the opener object is set to null. Otherwise, the browser (IE7 and IE8) will pop up a confirmation and close dialog box.
Copy to ClipboardReference: [www.bkjia.com] <script language = "javaScript">
Function closeWindow ()
{
Window. opener = null;
Window. open ('', '_ self ','');
Window. close ();
}
</Script>
<Input type = 'button 'value = 'close window' onClick = "closeWindow ()">
Or
Copy to ClipboardReference: [www.bkjia.com] <input type = "button" value = "Close window" onClick = "window. opener = null; window. open ('', '_ self',''); window. close () ">
For closing the frame window:
Copy to ClipboardReference: [www.bkjia.com] <script language = "javaScript">
Function closeWindow ()
{
Window. opener = null;
Window. open ('', '_ top ','');
Window. parent. close ();
}
</Script>