This article describes the JS control page full screen display and exit Full-screen display method. Share to everyone for your reference. The implementation methods are as follows:
Copy Code code as follows:
<! DOCTYPE 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" >js control page full screen display and exit full screen </button>
<div id= "Content" style= "margin:0 auto;height:500px;width:700px; Background: #ccc; ">
<H1>JS Control page Full screen display and exit full screen </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.mozrequestfullscreen | | 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>
I hope this article will help you with your JavaScript programming.