[Switch] JSP webpage full screen display, exit full screen, close page
JSP related knowledge 20:36:42 read 108 comments 0 font size: Large Medium Small subscription
Full Screen Display
Certificate --------------------------------------------------------------------------------------------------------------------------------------------------------------------
First:
On a common web page that has been opened, click "full screen" and enter the full screen mode corresponding to the web page. Method: Add the following code between the <body> and </body> Of the webpage:
<Form>
<Input type = "button" name = "fullscreen" value = "full screen" onclick = "window. open (document. location, 'Big ', 'fullscreen = yes') ">
</Form>
If the full screen is not displayed on this page, you only need to replace document. location with the corresponding URL, that is, the following code:
<Form>
<Input type = button name = fullscreen value = onclick = "window. Open ('url address', 'Big ', 'fullscreen = yes')">
</Form>
Second:
When running a webpage, for example, you enter http: // localhost: 8080/temp in the URL bar. JSP: Close the web page and display a blank full-screen web page by writing the following code in the body:
<Body onload = Window. Open ('','', fullscreen = 1); opener = NULL; window. Close ()>
</Body>
Third:
In fact, it is the superposition of the above two types. Generally, this situation is also used more. When a webpage is opened directly, it enters the full screen mode. This is different from the first one, because after you click the "full screen display" button, it is a new full-screen web page, but the original normal Web page still exists, so this is better. Method: create two JSP files. The first one only runs the following code, for example, the name is demo. JSP; the second is the content you actually want to run, such as: temp. JSP:
Demo. jsp:
<Body onload = "window. Open ('temp. jsp ',' _ blank ', 'fullscreen = 1'); opener = NULL; window. Close ()">
</Body>
Temp. jsp:
<% @ Page contenttype = "text/html; charset = gb2312" Language = "Java" %>
<HTML>
<Body>
Here is my full screen content. Let's take a look at the demo. jsp we entered in the address bar. Is it disabled? OK!
</Body>
</Html>
Exit full screen
Certificate --------------------------------------------------------------------------------------------------------------------------------------------------------------------
To exit full screen, I have searched a lot of information on the Internet. In general, it is difficult to achieve our desired goals, such: we can add a hyperlink <a href = "" target = "_ blank"> to open it in a new window, or apply the inverse method of the method to open full screen. However, no matter how it works, when switching from full screen to normal mode, it is always equivalent to re-opening a window. In this way, adding our original full screen mode is playing a movie, if you switch to normal mode, you have to reload it. However, there is no way. Now I will refer to the reply on the 5th floor in this post: Success. The Code is as follows:
<% @ Page contenttype = "text/html; charset = gb2312" Language = "Java" %>
<Script language = "jscript">
VaR o = 1;
Function goresize ()
{
VaR d = Document. Body, E = event, M = event. srcelement; O?
New Function () {moveBy (E. clientX-e.screenX, E. clienty-e. screeny); resizeBy (screen. availWidth-d.offsetWidth, screen. availheight-D. offsetheight); M. value = "cancel"; O = 0 }:
New Function () {moveTo (0, 0); resizeTo (screen. availwidth, screen. availheight); M. value = "full screen"; O = 1}
}
</SCRIPT>
<Input type = "button" value = "full screen" onclick = "goresize ()">
Close page
Certificate --------------------------------------------------------------------------------------------------------------------------------------------------------------------
To close the page, you only need to add such a hyperlink to the page:
<A href = "javascript: Self. Close ()"> close the window </a>
Code for closing pages in JSP and HTML
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>
Type 4: JSP code that prompts information and closes the window automatically after ASP code is submitted
Response. Write "<script language = JavaScript> alert ('your message is sent successfully. We will contact you as soon as we see it! '); Opener = NULL; window. Close (); </SCRIPT>"
Code for automatically returning the previous page:
Response. Write ("<script language =" "JavaScript" "> alert (" "Your message is sent successfully. We will contact you as soon as we see it! ""); History. Go (-1); </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 ();
}