zoukankan      html  css  js  c++  java
  • 按ECS退出全屏模式

    <!DOCTYPE html>
    <html>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>js全屏和退出全屏代码</title>
    <body>
    <!--

      requestFullScreen(document.documentElement): 整个网页进入全屏
      requestFullScreen(document.getElementById("video-box")): 指定某块区域全屏
    -->
    <button onclick="requestFullScreen(document.documentElement)">全屏显示</button>
    <button onclick="exitFull()">退出全屏</button>
    </body>
    <script type="text/javascript">
    function requestFullScreen(element) {
      // 判断各种浏览器,找到正确的方法
      let requestMethod = element.requestFullScreen || //W3C
      element.webkitRequestFullScreen || //Chrome等
      element.mozRequestFullScreen || //FireFox
      element.msRequestFullScreen; //IE11
      if (requestMethod) {
        requestMethod.call(element);
      }
      else if (typeof window.ActiveXObject !== "undefined") {//for Internet Explorer
        var wscript = new ActiveXObject("WScript.Shell");
        if (wscript !== null) {
          wscript.SendKeys("{F11}");
        }
      }
    }
    //退出全屏 判断浏览器种类
    function exitFull() {
      // 判断各种浏览器,找到正确的方法
      var exitMethod = document.exitFullscreen || //W3C
      document.mozCancelFullScreen || //Chrome等
      document.webkitExitFullscreen || //FireFox
      document.webkitExitFullscreen; //IE11
      if (exitMethod) {
        exitMethod.call(document);
      }
      else if (typeof window.ActiveXObject !== "undefined") {//for Internet Explorer
        var wscript = new ActiveXObject("WScript.Shell");
        if (wscript !== null) {
          wscript.SendKeys("{F11}");
        }
      }
    }
    </script>
    </html>

  • 相关阅读:
    UML各种图总结
    信息系统安全等级保护基本要求
    MySQL InnoDB表空间加密
    服务器常见操作问题
    公众号-接口配置信息 接口实现 netcore
    某些时候命令绑定可能会存在刷新不及时,往往需要点击一次程序才能激活,特此记录下解决方案
    c#几种场景获取程序运行目录
    wpf 控件绑定鼠标命令、键盘命令
    并发特别高的时候,随机数的种子生成
    mongodb占用大量内存
  • 原文地址:https://www.cnblogs.com/zhoudawei/p/9692076.html
Copyright © 2011-2022 走看看