<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
</head>
<body id="content">
<button id="btu">现代浏览器全屏</button>
</body>
</html>
<script>
window.onload = function() {
function fullScreen(el) {
var 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}");
}
}
}
var btn = document.getElementById('btu');
var content = document.getElementById('content');
btn.onclick = function() {
fullScreen(content);
}
}
</script>