• js 实现浏览器全屏效果


    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>quanping</title>
    </head>
    <body>
        <div id="div" onclick="fullScreen()">全屏</div>
        <div onclick="exitFull()">退出全屏</div>
        <script type="text/javascript">
            function fullScreen(){
                var el = document.documentElement;
                var rfs = el.requestFullScreen || el.webkitRequestFullScreen || el.mozRequestFullScreen || el.msRequestFullscreen;      
                    if(typeof rfs != "undefined" && rfs) {
                        rfs.call(el);
                    };
                  return;
            }
    
            function exitFull() {
             var exitMethod = document.exitFullscreen || 
             document.mozCancelFullScreen || 
             document.webkitExitFullscreen || 
             document.msExitFullscreen; 
             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}");
              }
             }
            }
    
            document.getElementById('div').click();
        </script>
    </body>
    </html>

    本示例可实现点击全屏效果,但是这个API接口不能实现,页面加载完成就执行全屏的效果

  • 相关阅读:
    powershell,系统学习的第一种脚本语言
    mysql的source命令
    timer--计时器
    document.write 方法
    数组去重
    Abdicate
    轮播图
    使用 margin 让div块内容居中
    模运算 NOJ 1037
    模运算 NOJ 1037
  • 原文地址:https://www.cnblogs.com/hss-blog/p/9040691.html
Copyright © 2020-2023  润新知