网页全屏显示代码说明分析
作者:bea
最常见的是使用window.open的方法,直接打开全屏网页: <script> <!-- function fullwin(){ window.open("bigpage.html","bfs","fullscreen,scrollbars") } //--> </script> <center> <form> <input type="button" onClick="fullwin()" value=
最常见的是使用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>
[Ctrl+A 全选 注:
如需引入外部Js需刷新才能执行]
另外,如果想让已经打开的网页全屏,有以下两种方法:
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>
[Ctrl+A 全选 注:
如需引入外部Js需刷新才能执行]
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>
[Ctrl+A 全选 注:
如需引入外部Js需刷新才能执行]
有用 | 无用
<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>
[Ctrl+A 全选 注:
如需引入外部Js需刷新才能执行]
另外,如果想让已经打开的网页全屏,有以下两种方法:
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>
[Ctrl+A 全选 注:
如需引入外部Js需刷新才能执行]
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>
[Ctrl+A 全选 注:
如需引入外部Js需刷新才能执行]
有用 | 无用
猜你喜欢
您可能感兴趣的文章:
- jQuery 相关控件的事件操作分解
- 利用javascript实现一些常用软件的下载导航
- [原创]javascript 定时广告显示(两个时间段)
- jQuery 隔行换色 支持键盘上下键,按Enter选定值
- 一句话JavaScript表单验证代码
- JavaScript 关键字屏蔽实现函数
- Javascript 验证上传图片大小[客户端]
- Javascript 汉字字节判断
- JS 输入字数判断实现代码
- JS 面向对象的5钟写法
- JS 事件冒泡 示例代码
- Document 对象的常用方法
- javascript getElementsByName()的用法说明
- extjs 列表框(multiselect)的动态添加列表项的方法
- JavaScript 学习小结(适合新手参考)
- JavaScript 创建对象和构造类实现代码
- Javascript 类的继承实现代码
- Javascript 学习笔记 错误处理
- JS 学习笔记 防止发生命名冲突