行测侠网站之样式保存,隐藏滚动条并可滚动,全屏显示
2020-05-14
2 min read
1.行测侠-一个快捷高效的在线行测刷题网站
样式保存
html5 localStorage
隐藏滚动条并可滚动
<style>
::-webkit-scrollbar{display: none;}
</style>
全屏显示
<button onclick="return ExecuteFun(this)" >全屏</button>
<script type="text/javascript">
function ExecuteFun(a) {
var full = a.innerHTML == '全屏';
full ? fullscreen() : exitfullscreen();
a.innerHTML = full ? '返回' : '全屏';
return false;
}
function fullscreen() {
var el = document.documentElement,
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}");
}
}
}
function exitfullscreen() {
var el = document,
cfs = el.cancelFullScreen || el.webkitCancelFullScreen || el.mozCancelFullScreen || el.exitFullScreen,
wscript;
if (typeof cfs != "undefined" && cfs) {
cfs.call(el);
return;
}
if (typeof window.ActiveXObject != "undefined") {
wscript = new ActiveXObject("WScript.Shell");
if (wscript != null) {
wscript.SendKeys("{F11}");
}
}
}
</script>