標籤:表示 text for 重新整理 war onclick pre htm length
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <title></title> 5 <script type="text/javascript"> 6 7 /* 8 screen 螢幕對象 9 ------------------- 屬性 ---------------------10 width: 螢幕寬度11 height: 螢幕高度12 availWidht: 有效寬度, 不含工作列13 availHeight: 有效高度, 不含工作列14 都是唯讀屬性15 */16 var str = "<h2>螢幕的尺寸</h2>"17 str += "寬度: " + screen.width + ", 高度: " + screen.height + "<br>";18 str += "有效寬度: " + screen.availWidth + ", 有效高度: " + screen.availHeight + "<br>";19 document.write(str);20 document.write("<hr>");21 22 /*23 navigator 瀏覽器對象24 ------------------- 屬性 ---------------------25 appName: 軟體名稱26 appVersion: 核心版本27 systemLanguage: 系統語言28 userLanguage: 使用者語言29 platform: 使用者平台30 */31 var str = "<h2>瀏覽器資訊</h2>";32 str += "appName: " + navigator.appName;33 str += "<br>appVersion: " + navigator.appVersion;34 str += "<br>systemLanguage: " + navigator.systemLanguage;35 str += "<br>userLanguage: " + navigator.userLanguage;36 str += "<br>platform: " + navigator.platform;37 document.write(str);38 document.write("<hr>");39 40 /*41 location 地址欄對象42 ------------------- 屬性 ---------------------43 href: 擷取完整的地址, 可以實現JS的網頁跳轉44 host: 主機名稱45 hostname: 主機名稱46 pathname: 檔案路徑及檔案名稱47 search: 查詢字串48 protocol: 協議 http:// ftp://49 hash: 錨點名稱 #top50 reload(true): 重新整理網頁, true表示強制重新整理51 */52 // 3秒後跳轉百度53 // window.setTimeout("location.href = ‘http://www.baidu.com‘", 3000);54 55 /*56 histroy 記錄對象57 ------------------- 屬性 ---------------------58 length: 記錄個數59 go(n): 前進n頁60 go(0): 重新整理61 go(-n): 後退n頁62 forward(): 前進63 back(): 後退64 */65 </script>66 </head>67 <body>68 69 <!-- 地址欄對象 -->70 <input type="button" value="重新整理網頁" onclick="javascript:location.reload(true)">71 <hr>72 73 <!-- 記錄對象 -->74 <a href="news.html">新聞</a>75 <input type="button" value="前進" onclick="history.go(1)">76 77 </body>78 </html>
<JavaScript> 九. BOM其它對象(screen對象, navigator對象, location地址欄對象, history記錄對象)