首页 > 编程 > JavaScript > 正文

js控制浏览器全屏示例代码

2019-11-20 21:04:15
字体:
来源:转载
供稿:网友
复制代码 代码如下:

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");
if (wscript != null) {
wscript.SendKeys("{F11}");
}
}

}
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表