この記事では、JSコントロールページのフル画面表示と終了フルスクリーンディスプレイについて説明します。参照のためにそれを共有してください。特定の実装方法は次のとおりです。
次のようにコードをコピーします:<!doctype html>
<html>
<Meta http-equiv = "content-type" content = "text /html; charset = utf-8" />
<body>
<div style = "マージン:0 auto; height:600px; width:700px;">
<ボタンID = "btn"> jsコントロールページフルスクリーンディスプレイと終了フルスクリーンディスプレイ</button>
<div id = "content" style = "マージン:0 auto; height:500px; width:700px; background:#ccc;" >
<h1> jsコントロールページフルスクリーンディスプレイと終了フルスクリーンディスプレイ</h1>
</div>
</div>
</body>
<スクリプト言語= "javascript">
document.getElementById( "btn")。onclick = function(){
var elem = document.getElementById( "content");
requestfullscreen(elem);
};
function requestfullscreen(element){
var requestmethod = element.requestfullscreen || Element.WebKitRequestfullscreen || Element.MozRequestfullscreen || element.msRequestfullscreen;
if(requestmethod){
requestmethod.call(element);
} else if(typeof windof.activexobject!== "undefined"){
var wscript = new ActiveXObject( "wscript.shell");
if(wscript!== null){
wscript.sendkeys( "{f11}");
}
}
}
</script>
</html>
この記事がみんなのJavaScriptプログラミングに役立つことを願っています。