window.open 打开全屏窗口

1,利用winID = window.open(url,name,features,replace); 中的features中的属性来使新窗口全屏化

2,应用领域,需要全屏显示网页的页面。

代码如下:

 

 

代码
 1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 2 <html xmlns="http://www.w3.org/1999/xhtml">
 3 <head>
 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 5 <title>无标题文档</title>
 6 
 7 <script language="javascript">
 8 
 9  var winID = null;
10   function openFullWindow(url,winname)
11   {
12      var strFeatures = "left=0,screenX=0,top=0,screenY=0";  
13      if (window.screen)
14      {
15          //获取屏幕的分辨率
16           var maxh = screen.availHeight-30;
17           var maxw = screen.availWidth-10;
18           strFeatures += ",height="+maxh;
19           strFeatures += "innerHeight"+maxh;
20            strFeatures += ",width="+maxw;
21           strFeatures += "innerwidth"+maxw;
22      }
23      else
24      {
25          strFeatures +=",resizable"
26          
27      }
28      winID = window.open(url,winname,strFeatures);
29      
30   }
31 
32 
33 </script>
34 
35 
36 
37 </head>
38 
39 <body>
40 <h2>打开全屏窗口</h2>
41 <form>
42    <input type="button" value="打开全新窗口" onclick="openFullWindow('windowTime.html','JS')" />
43  
44 </form>
45 
46 </body>
47 </html>
48 

 

    var maxh = screen.availHeight-30;
          var maxw = screen.availWidth-10;

以上这两句可以设置窗口的大小

 

总结:碰到的问题onclick="openFullWindow('windowTime.html','JS')" 中的windowTime.html忘记使用单引号。

 

 

posted on 2010-04-19 17:45  wtq  阅读(5389)  评论(0编辑  收藏  举报