First: automatically close the window at regular JS time
Copy codeThe Code is as follows:
<Script language = "javascript">
<! --
Function closewin (){
Self. opener = null;
Self. close ();}
Function clock () {I = I-1
Document. title = "this window will be closed automatically after" + I + "seconds! ";
If (I> 0) setTimeout ("clock ();", 1000 );
Else closewin ();}
Var I = 10
Clock ();
// -->
</Script>
Type 2: Click the JS button that does not prompt to close the window
Copy codeThe Code is as follows:
<A href = "javascript: self. close ()"> close the window </a>
Third: js Code that is automatically disabled is not prompted in the window
<Script language = javascript>
<! --
This. window. opener = null;
Window. close ();
// -->
</Script>
Third: js Code that prompts information after submitting the php code window and closes the Window Automatically
Copy codeThe Code is as follows:
Document. write "<script language = javascript> alert! '); Opener = null; window. close (); </script>"
Code for automatically returning the previous page:
Copy codeThe Code is as follows:
Document. write ("<script language =" "JavaScript" "> alert (" "Your message is sent successfully. We will contact you as soon as we see it! ""); History. go (-1); </script> ")
Method of closing window without prompting for IE6-7 JS
Method 1:
Js Code
Copy codeThe Code is as follows:
Function CloseWin () // This does not prompt whether to close the browser
{
Window. opener = null;
// Window. opener = top;
Window. open ("", "_ self ");
Window. close ();
}
Method 2:
Open.html
Copy codeThe Code is as follows:
Js Code
Function open_complex_self (){
Var obj_window = your own open('close.html ',' _ self ');
Obj_1_1_opener = window;
Obj_1_1_focus ();
}
Close.html
Js Code
Copy codeThe Code is as follows:
Window. close ();
Appendix:
Copy codeThe Code is as follows:
// The error message "close" appears in the normal mode.
Function closeie (){
Window. close ();
}
// Disable IE6. No prompt
Function closeie6 (){
Window. opener = null;
Window. close ();
}
// Disable IE7. No prompt
Function closeie7 (){
Window. open ('', '_ top ');
Window. top. close ();
}