怎么让html页面加载自动f11_HTML+JS实现F11全屏、退出全屏功能

复制一下代码在HTML文件中打开即可

function kaishi()

{

var docElm = document.documentElement;

//W3C

if (docElm.requestFullscreen) {

docElm.requestFullscreen();

}

//FireFox

else if (docElm.mozRequestFullScreen) {

docElm.mozRequestFullScreen();

}

//Chrome等

else if (docElm.webkitRequestFullScreen) {

docElm.webkitRequestFullScreen();

}

//IE11

else if (elem.msRequestFullscreen) {

elem.msRequestFullscreen();

}

}

function guanbi() {

if (document.exitFullscreen) {

document.exitFullscreen();

}

else if (document.mozCancelFullScreen) {

document.mozCancelFullScreen();

}

else if (document.webkitCancelFullScreen) {

document.webkitCancelFullScreen();<

你可能感兴趣的:(怎么让html页面加载自动f11_HTML+JS实现F11全屏、退出全屏功能)