JS浏览器对象-window对象

代码:

 1 <!DOCTYPE html>
 2 <html>
 3 <head>
 4 <meta charset="UTF-8">
 5 <title>uvi</title>
 6      <link rel="stylesheet" href="style.css" type="text/css">
 7 </head>
 8 <body>
 9    <button id="btn" onclick="btnClicked()">按钮</button>
10    <script>
11       window.document.write("hello");
12       
13       //获取浏览器的宽度和高度
14       document.write("宽度="+window.innerWidth+",高度="+window.innerHeight);
15       
16       //点击按钮会打开index5.html这个页面
17       function btnClicked(){
18           window.open("index5.html","windowname","height=200,width=200,top=100,left=100,toolbar=no,menubar=no");
19           //3个参数,(url,名称,具体设置)
20       }
21       //window.close();关闭页面
22    </script>
23    
24 </body>
25 </html>
原文地址:https://www.cnblogs.com/UniqueColor/p/5755814.html