網頁制作poluoluo文章簡介:最常見的是使用window.open的方法,直接打開全屏網頁.
最常見的是使用window.open的方法,直接打開全屏網頁:
<script>
<!--
function fullwin(){
window.open("bigpage.html","bfs","fullscreen,scrollbars")
}
//-->
</script>
<center>
<form>
<input type="button" onClick="fullwin()" value="Open Full Screen Window">
</form>
</center>
另外,如果想讓已經打開的網頁全屏,有以下兩種方法:
1.使用ActiveX
<html>
<head>
<title>test</title>
<script language="JavaScript">
function Fkey(){
var WsShell = new ActiveXObject('WScript.Shell')
WsShell.SendKeys('{F11}');
}
</script>
</head>
<body>
<a href="javascript:Fkey()">to full</a>
</body>
</html>
2.使用window.open模擬當前頁:
<SCRIPT language="JavaScript">
function toFull(){
if(window.name=="fullscreen")return;
var a =window.open("","fullscreen","fullscreen=yes")
a.location = window.location.href
window.opener=null
window.close()
}
</SCRIPT>
<html>
<body>
<input type=button value="full" onclick=toFull()>
</body>
</html>