Js full screen displays three ways to display code

  • 2020-03-27 00:00:35
  • OfStack

The first:
            On a normal page that is already open, click "display in full screen" and enter the corresponding full-screen mode for that page. Methods: on the web < Body> With < / body> Add the following code between:

<form>
<input type="BUTTON" name="FullScreen" value=" Full screen " onClick="window.open(document.location, 'big', 'fullscreen=yes')">
 </form>
 

              If this page is not displayed in the full screen, just change the document.location to the corresponding url, that is, the following code:

<form>
<input type=BUTTON name=FullScreen value= Full screen  onClick="window.open('URL address ','big','fullscreen=yes')">
 </form>
 

The second:
            When running a web page, such as your direct input in the address bar: http://localhost:8080/temp.jsp, at this time to close the page, show a blank full screen web page at the same time, the method is: in the body to write the following code:
 

<body onload=window.open('','',fullscreen=1);opener=null;window.close()>
</body>

The third:
              It is the superposition of above two kinds actually, this kind of circumstance also USES commonly more. When you open a page directly, you go into full screen mode, which is different from the first one, because the first one, when you click the "full screen display" button, it opens a new full screen page, but the normal page still has it, so this is better. Method: create two JSP files, the first one only run the following code, such as the name of demo.jsp; The second is what you actually want to run, such as: temp.jsp:

The 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>
 So here's my full screen, and let's see what we typed in the address bar demo.jsp Is it closed? OK , done! 
</body>
</html>

Exit full screen
--------------------------------------------------------------------------------------------------------------------------------------------------------------------

I've done a lot of research on the Internet to get out of the full screen, and in general, it's hard to get what we want. A href = "" target =" _blank "> Open in a new window; You can also do this by applying the inverse of the full screen method above. But anyway, when you finally switch from full screen to normal mode, it's always the same thing as opening a window again, which means that if you switch to normal mode, you're going to have to reload the movie. But, can't, I can see now in the fifth floor of the reply this post: http://topic.csdn.net/t/20021028/12/1130882.html, in this method, generally also go to, just, this method is not called a full-screen, it quite so the translation must the window up height, we still can drag the window. 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 the page
--------------------------------------------------------------------------------------------------------------------------------------------------------------------

If you want to close the page, you just need to add such a hyperlink to the page:

<a href="javascript:self.close()" > Close the window </a>

Related articles: