首页 > 网站 > WEB开发 > 正文

网站设计打开全屏网页的两种方法

2024-04-27 14:47:11
字体:
来源:转载
供稿:网友

 网站设计如果想让打开的网页全屏,有以下两种方法:

  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>


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表