Close pages in JSP and HTML

Source: Internet
Author: User

 

First, the window is automatically closed at a scheduled time in JSP.
<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: Close the window by clicking the JSP that is not prompted for the link
<A href = "javascript: Self. Close ()"> close the window </a>

Third: The Window does not display the JSP code that is automatically closed.
<Script language = JavaScript>
<! --
This. Window. Opener = NULL;
Window. Close ();
// -->
</SCRIPT>

IE6-7 JSP Close Window does not prompt Method

Method 1:
JSP code: Jining website creation
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
JSP 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
JSP code
Window. Close ();

Appendix:
// 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 ();
}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.