码迷,mamicode.com
首页 > Web开发 > 详细

html页面全屏化显示

时间:2017-05-23 15:53:37      阅读:408      评论:0      收藏:0      [点我收藏+]

标签:board   onload   load   methods   cancel   oar   stand   cli   keyboard   

<html>
<head>
<script>
// toggle full screen
function toggleFullScreen() {
if (!document.fullscreenElement && // alternative standard method
!document.mozFullScreenElement && !document.webkitFullscreenElement) { // current working methods
if (document.documentElement.requestFullscreen) {
document.documentElement.requestFullscreen();
} else if (document.documentElement.mozRequestFullScreen) {
document.documentElement.mozRequestFullScreen();
} else if (document.documentElement.webkitRequestFullscreen) {
document.documentElement.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT);
}
} else {
if (document.cancelFullScreen) {
document.cancelFullScreen();
} else if (document.mozCancelFullScreen) {
document.mozCancelFullScreen();
} else if (document.webkitCancelFullScreen) {
document.webkitCancelFullScreen();
}
}
}
window.onload = function () {
toggleFullScreen();
}
</script>
</head>
<body>
<div onclick=‘toggleFullScreen();‘>全屏</div>
</body>
</html>

html页面全屏化显示

标签:board   onload   load   methods   cancel   oar   stand   cli   keyboard   

原文地址:http://www.cnblogs.com/liwp/p/6894067.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!