您的位置:首页 > Web前端 > JavaScript

JavaScript:让浏览器全屏显示

2015-11-04 14:21 501 查看
  并不是所有人都会按F11让浏览器全屏显示~~~

一、直接上代码

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>index</title>
</head>
<body>
<input type="button" value="全屏显示" onclick="fullScreen()">
<script>

function fullScreen() {
var el = document.documentElement;
var rfs = el.requestFullScreen || el.webkitRequestFullScreen || el.mozRequestFullScreen || el.msRequestFullScreen;

if (typeof rfs !== "undefined" && rfs) {
rfs.call(el);
} else if (typeof window.ActiveXObject !== "undefined") {
// for Internet Explorer
var wscript = new ActiveXObject("WScript.Shell");
wscript.SendKeys("{F11}");
}
}

</script>
</body>
</html>


  通过FireFox、360浏览器的极速模式和兼容模式等测试

  

  【参考地址】/article/1249540.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: