none
js能做到完全全屏吗? RRS feed

答案

  • 这个取决于客户端浏览器是否实现了这个功能。

    The following is signature, not part of post
    Please mark the post answered your question as the answer, and mark other helpful posts as helpful, so they will appear differently to other users who are visiting your thread for the same problem.
    Visual C++ MVP
    2010年6月18日 22:59
  • 不能实现
    【孟子E章】
    2010年6月22日 2:38
    版主

全部回复

  • 如果你想实现按F11的效果

    1.

    <head runat="server">
        <title></title>
       <script language="JavaScript">
           function Fkey() {
               var WsShell = new ActiveXObject('WScript.Shell')
               WsShell.SendKeys('{F11}');
           }
    </script>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
        <a href="javascript:Fkey()">to full</a>

        </div>
        </form>

    2.

    <head runat="server">
        <title></title>
        <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>  

    </head>
    <body>
        <form id="form1" runat="server">
        <div>
        <input type=button value="full" onclick=toFull()> 
        </div>
        </form>
    </body>

     

    你也可以使用SILVER或者FLASH实现,这样效果更好

    参照

    http://www.klstudio.com/demo/as/fullscreen/fullscreen.html


    努力+方法=成功
    2010年6月18日 9:54
  • 这个取决于客户端浏览器是否实现了这个功能。

    The following is signature, not part of post
    Please mark the post answered your question as the answer, and mark other helpful posts as helpful, so they will appear differently to other users who are visiting your thread for the same problem.
    Visual C++ MVP
    2010年6月18日 22:59
  • 用javascript实现强制网页全屏,最常用的就是使用window.open的方法,直接打开全屏的网页:
    <script type="text/javascript">
    function fullwin(){
    window.open("http://www.phpzixue.cn","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 type="text/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>
    2010年6月22日 2:36
  • 不能实现
    【孟子E章】
    2010年6月22日 2:38
    版主