導航:首頁 > 編程語言 > js頁面強制全屏實現

js頁面強制全屏實現

發布時間:2023-02-28 08:07:41

js怎麼使當前打開的網頁全屏

|||

//你看一下,這個可以嗎!
functionfullScreen(){
varel=document.documentElement;
varrfs=el.requestFullScreen||專el.webkitRequestFullScreen||el.mozRequestFullScreen||el.msRequestFullScreen;

if(typeofrfs!屬="undefined"&&rfs){
rfs.call(el);
}elseif(typeofwindow.ActiveXObject!="undefined"){
//forInternetExplorer
varwscript=newActiveXObject("WScript.Shell");
if(wscript!=null){
wscript.SendKeys("{F11}");
}
}

}

⑵ 求大神賜教,請問如何用JS實現網頁的完全全屏.

Option.prototype.toggleFullscreen=function(){
if((document.fullScreenElement&&document.fullScreenElement!==null)||
(!document.mozFullScreen&&!document.webkitIsFullScreen)){
this.enterFullscreen(document.documentElement);
}else{
this.cancelFullscreen();
}
};


Option.prototype.enterFullscreen=function(docElm){
if(docElm.requestFullscreen){
docElm.requestFullscreen();
}
elseif(docElm.mozRequestFullScreen){
docElm.mozRequestFullScreen();
}
elseif(docElm.webkitRequestFullScreen){
docElm.webkitRequestFullScreen();
}
};

Option.prototype.cancelFullscreen=function(){
if(document.exitFullscreen){
document.exitFullscreen();
}
elseif(document.mozCancelFullScreen){
document.mozCancelFullScreen();
}
elseif(document.webkitCancelFullScreen){
document.webkitCancelFullScreen();
}
};

⑶ js或者jquery實現頁面中的一個div全屏

1、引入外部jquery文件
比如:

<scriptsrc="Scripts/jquery-1.3.2.min.js"type="text/javascript"></script>

2、點擊按鈕時的JQuery代碼

$(document).ready(function(){
$("#go").click(function(){
/*屬性*/
$("#go2").css({"position":"absolute","text-align":"center","top":"0px","left":"0px","right":"0px","bottom":"0px","background":"red","visibility":"visible","filter":"Alpha(opacity=90)"
});
/*高為屏幕的高*/
$("#go2").css({
height:function(){
return$(document).height();
},
width:"100%"
});
});
});

3、html頁面代碼

<asp:ButtonID="go"runat="server"Style="width:380px;position:absolute;top:249px;left:425px;background-color:Green;height:65px;"Text="後台執行程序,前台遮蓋,運行完畢後自動消失"/>
<divid="go2">
正在提交數據...
</div>

⑷ 怎麼用JS實現網站全屏

那就用JS模擬按鍵F11實現吧!<html>
<head>
<title>JS模擬按鍵</title>
<script type="text/javascript">
function $(id){return document.getElementById(id)}
function loadListener(){
$("testBtn").onclick=function(){
var WshShell = new ActiveXObject('WScript.Shell')
WshShell.SendKeys('{F11}');
}
}
window.attachEvent("onload",loadListener);
</script>
<body>
我要實現這樣一個效果:<br/>
當滑鼠點擊下專面這個button時,就觸發鍵盤按屬鍵事件,並且按下的鍵要為 F11,這樣當前窗口就會全屏.<br/>
<input type="button" id="testBtn" value="點我全屏化">
</body>
</head>
</html>

⑸ 如何用html5 js實現瀏覽器全屏

項目中需要將後台瀏覽器的窗口全屏,也就是我們點擊一個按鈕要實現按F11全屏回的效果。
在HTML5中,W3C制定了關於答全屏的API,就可以實現全屏幕的效果,也可以讓頁面中的圖片,視頻等全屏目前只有google
chrome
15
+,
safri5.1+,firfox10+,IE11支持
全屏
var
docElm
=
document.documentElement;
//W3C
if
(docElm.requestFullscreen)
{
docElm.requestFullscreen();
}
//FireFox
else
if
(docElm.mozRequestFullScreen)
{
docElm.mozRequestFullScreen();
}
//Chrome等
else
if
(docElm.webkitRequestFullScreen)
{
docElm.webkitRequestFullScreen();
}
//IE11
else
if
(elem.msRequestFullscreen)
{
elem.msRequestFullscreen();
}

⑹ 真心求教JS使得當前網頁全屏的代碼啊!

<!doctypehtml>
<html>
<head>
<metacharset="utf-8">
<title>全屏</title>
</head>

<body>
</body>
<scripttype="text/javascript">
window.onload=function(){
varRequest=newArray();//保存參數
vars=location.search.substring(1);
if(s&&s!=""){
=s.split("&");
for(vari=0;i<list.length;i++){
varpair=list[i].split("=");
if(pair[0]&&pair[0]!=""){
Request[unescape(pair[0])]=unescape(pair[1]);
}
}
}

varfullscreen=Request["fullscreen"];
if(fullscreen!="yes"){
varfile=self.location;
vara=window.open("about:blank","","fullscreen=yes");
self.opener=null;
self.close();
a.location=file+"?fullscreen=yes";
}
}
</script>
</html>


這個是比較早期的全屏代碼,現在有純正的全屏API,但瀏覽器兼容性很不好,只支持chrome和firefox最新版本瀏覽器,其它的都不支持,所以還是用這個吧。


上面的代碼已經搞定,打開後會自動進入全屏模式,當然,必須要允許這個網頁自動彈出窗口才行。

⑺ 用js怎樣實現打開網頁時就全屏顯示,要支持chrome,Firefox,IE等主流瀏覽器,求大神幫忙啊!

您好!來很高興為您答疑!源

實現窗口全屏(F11效果),只需在下面屬性中加一條fullscreen = yes即可
<script>
<!--
function windowopen(){
var target="http://play.zol.com.cn"
newwindow=window.open("","","scrollbars")
if (document.all){
newwindow.moveTo(0,0)
newwindow.resizeTo(screen.width,screen.height)
}
newwindow.location=target
}
//-->
</script>
<form>
<input type="button" onClick="windowopen()" value="全屏顯示" name="button">
</form>

您可以在火狐社區了解更多內容。希望我的回答對您有所幫助,如有疑問,歡迎繼續在本平台咨詢。

閱讀全文

與js頁面強制全屏實現相關的資料

熱點內容
微信小程序按鈕顏色 瀏覽:69
長江大學網課用什麼app 瀏覽:431
華中系統圖紙編程哪個刀好 瀏覽:38
地方債務數據在哪裡查看 瀏覽:932
掃描文件怎麼設置格式 瀏覽:957
蘋果郵箱主機名填什麼 瀏覽:630
多張圖片同一個文件夾 瀏覽:798
win7怎麼打開shs文件 瀏覽:481
怎麼把文件夾做成iso 瀏覽:164
繽客網站上的房價怎麼在哪裡修改 瀏覽:406
單片機c51計數器實驗代碼 瀏覽:990
宏編程滑鼠代表什麼意思 瀏覽:753
別人撿到蘋果6有用嗎 瀏覽:829
word文件用wps打開 瀏覽:477
macbook修改文件格式軟體 瀏覽:757
美版s7edge那個版本好 瀏覽:529
視頻隱藏在文件夾里 瀏覽:144
網路通訊基礎是什麼 瀏覽:209
辦公電腦文件管理 瀏覽:222
火化費報銷文件有哪些 瀏覽:998

友情鏈接