JS控制浏览器全屏详解编程语言

  
function fullScreen() { 
    var el = document.documentElement, 
        rfs = el.requestFullScreen || el.webkitRequestFullScreen || el.mozRequestFullScreen || el.msRequestFullScreen, 
        wscript; 
   
    if(typeof rfs != "undefined" && rfs) { 
        rfs.call(el); 
        return; 
    } 
   
    if(typeof window.ActiveXObject != "undefined") { 
        wscript = new ActiveXObject("WScript.Shell"); 
        if(wscript) { 
            wscript.SendKeys("{F11}"); 
        } 
    } 
} 
   
function exitFullScreen() { 
    var el = document, 
        cfs = el.cancelFullScreen || el.webkitCancelFullScreen || el.mozCancelFullScreen || el.exitFullScreen, 
        wscript; 
   
    if (typeof cfs != "undefined" && cfs) { 
      cfs.call(el); 
      return; 
    } 
   
    if (typeof window.ActiveXObject != "undefined") { 
        wscript = new ActiveXObject("WScript.Shell"); 
        if (wscript != null) { 
            wscript.SendKeys("{F11}"); 
        } 
  } 
} 
  

原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/8868.html

(0)
上一篇 2021年7月18日
下一篇 2021年7月18日

相关推荐

发表回复

登录后才能评论