Javascript control page full screen display and exit full screen display, js full screen display
This article describes how to display the Javascript control page in full screen and exit full screen. Share it with you for your reference. The specific implementation method is as follows:
Copy codeThe Code is as follows: <! DOCTYPE html>
<Html>
<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8"/>
<Body>
<Div style = "margin: 0 auto; height: 600px; width: 700px;">
<Button id = "btn"> full screen display and exit full screen display on the js control page </button>
<Div id = "content" style = "margin: 0 auto; height: 500px; width: 700px; background: # ccc;">
<H1> JavaScript control page full screen display and exit full screen display </Div>
</Div>
</Body>
<Script language = "JavaScript">
Document. getElementById ("btn"). onclick = function (){
Var elem = document. getElementById ("content ");
RequestFullScreen (elem );
};
Function requestFullScreen (element ){
Var requestMethod = element. requestFullScreen | element. webkitRequestFullScreen | element. Required requestFullScreen | element. msRequestFullScreen;
If (requestMethod ){
RequestMethod. call (element );
} Else if (typeof window. ActiveXObject! = "Undefined "){
Var wscript = new ActiveXObject ("WScript. Shell ");
If (wscript! = Null ){
Wscript. SendKeys ("{F11 }");
}
}
}
</Script>
</Html>
I hope this article will help you design javascript programs.