網站設計如果想讓打開的網頁全屏,有以下兩種方法:
1.使用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>
2.使用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>