Method 1:
This method is successfully tested in IE7.
< Html >
< Head >
< Meta HTTP-equiv = "Content-Type" Content = "Text/html; charset = gb2312" >
< Title > Close the window without mentioning </ Title >
</ Head >
< Body >
< Script Language = "JavaScript" Type = "Text/JavaScript" >
FunctionClose ()
{
// Close the current window
Window. Open ('', '_ parent ','');
Window. Close ();
}
Function openwin (URL)
{
// Open the window in full screen, URL
Window. Open (URL, '_ blank', 'fullscreen = 1 ');
Close ();
}
</ Script >
< Input Type = "Button" Value = "Close" Onclick = "Close ();" />
</ Body >
</ Html >
Method 2:
1. Set the following sectionCodeAdd it to the worker where you want to close the IE window:
Geturl ("Javascript: Window. Opener = NULL; window. Close ();");
2. Add the following code to your button:
On (release ){
Geturl ("Javascript: Window. Opener = NULL; window. Close ();");
}
This cannot directly close the window opened by IE!
<Object ID = "webbrowser" width = 0 Height = 0 classid = "CLSID: 8856f961-340a-11d0-a96b-00c04fd705a2">
</Object>
<Input type = "button" name = "button" value = "Close Window" onclick = "document. All. webbrowser. execwb (45,1)">
Method 3:
If you press window. Close () on a page that is not opened by JS, there will be a prompt box, which is annoying. Now you don't need it. Close the window without a prompt box.
Try the following code:
<Object ID = webbrowser width = 0 Height = 0 classid = CLSID: 8856f961-340a-11d0-a96b-00c04fd705a2>
</Object>
<Input type = button name = button value = Close Window onclick = Document. All. webbrowser. execwb (45, 1)>
If you try to change the parameters, you will get some other functions:
Webbrowser. execwb () Open
Webbrowser. execwb () Close all existing IE Windows and open a new window
Webbrowser. execwb () Save the webpage
Webbrowser. execwb (6, 1) print
Webbrowser. execwb (7,1) print preview
Webbrowser. execwb (8, 1) print page settings
Webbrowser. execwb (10, 1) view page properties
Webbrowser. execwb () seems to be undo, to be confirmed
Select All webbrowser. execwb (17,1)
Webbrowser. execwb (22, 1) Refresh
Webbrowser. execwb () Close form no prompt
These are only valid for ie5.5 and later versions. I tested them in IE6 and passed them.