总是不通过,没办法,只能是从新宣布了,横竖我就是杠上了,大大小小写过许多前端殊效,固然也常常在网上copy或许修正人家的代码,我以为也挺好的,为何?!由于我想如许,你能怎么办,打我?
少废话,直接上代码,
JS代码
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}");
}
}
}
function exitFullScreen(el) {
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}");
}
}
}
HTML代码
近来受了一点点小刺激,对本身做的事情发生渺茫,不知道还要做这个做多久,另有我实在照样喜好设想多一些,另有我喜好设想,然则设想太难了,常常以为本身做的东西跟他人的,比起来差个好几万块钱,Why?你问我,我问谁。好吧,我也很恶棍。
举个小小例子,随意来一个按钮尝尝,按钮上在来个点击事宜切换。
<html id="Content">
<body>
<ul>
<li>
<a id="BtnFullOpen" href="javascript:void(0);" title="按“F11”进入全屏形式">
<i class="ace-icon fa fa-arrows-alt"></i>全屏检察
</a>
<a id="BtnFullQuite" href="javascript:void(0);" title="按“F11”封闭全屏形式" style="display:none;">
<i class="ace-icon fa fa-arrows-alt"></i>全屏封闭
</a>
</li>
<li>2</li>
<li>3</li>
<li>5</li>
</ul>
</body>
</html>
记得一定要加上挪用代码,挪用代码,挪用代码,说三遍…
JS挪用代码
var oBtnFullOpen = document.getElementById('BtnFullOpen');
var oContent = document.getElementById('Content');
oBtnFullOpen.onclick = function() {
fullScreen(oContent);
oBtnFullQuite.setAttribute("style", "display:block");
oBtnFullOpen.setAttribute("style", "display:none");
}
var oBtnFullQuite = document.getElementById('BtnFullQuite');
oBtnFullQuite.onclick = function() {
exitFullScreen(oContent);
oBtnFullQuite.setAttribute("style", "display:none");
oBtnFullOpen.setAttribute("style", "display:block");
};
只做个人备忘,不做任何宣布,不做信息交换。
只管拿去用,不谢!