Navigator 瀏覽器對(duì)象,包含了正在使用的 Navigator 的版本信息。反映了當(dāng)前使用的瀏覽器的資料。JavaScript 客戶端運(yùn)行時(shí)刻引擎自動(dòng)創(chuàng)建 navigator 對(duì)象。
          更詳細(xì)的信息可以去查msdn或者Navigator 2.0以后的說(shuō)明文檔,這里我們之做個(gè)簡(jiǎn)單的說(shuō)明
          包括一下幾大屬性:

          • appCodeName 返回瀏覽器的“碼名”(?),流行的 IE 和 NN 都返回 'Mozilla'。
            下面的例子顯示了 appCodeName 屬性的值:
            document.write("navigator.appCodeName 的值是" + navigator.appCodeName)
          • appName 返回瀏覽器名。IE 返回 'Microsoft Internet Explorer',NN 返回 'Netscape'。
            下面的例子顯示了 appName 屬性的值:
            document.write("navigator.appName 的值是 " + navigator.appName)
          • appVersion 返回瀏覽器版本,包括了大版本號(hào)、小版本號(hào)、語(yǔ)言、操作平臺(tái)等信息。
          • language 語(yǔ)言
          • mimeType 以數(shù)組表示所支持的MIME類(lèi)型
          • platform 返回瀏覽器的操作平臺(tái),對(duì)于 Windows 9x 上的瀏覽器,返回 'Win32'(大小寫(xiě)可能有差異)。
          • userAgent 返回以上全部信息。例如,IE5.01 返回 'Mozilla/4.0 (compatible; MSIE 5.01; Windows 98)'。
          • plugins 以數(shù)組表示已安裝的外掛程序
          • javaEnabled() 返回一個(gè)布爾值,代表當(dāng)前瀏覽器允許不允許 Java。

          檢測(cè)瀏覽器的版本、所支持的MIME類(lèi)型、已安裝的外掛程序(plug-in)。該對(duì)象包含兩個(gè)子對(duì)象:外掛對(duì)象、MIME類(lèi)型對(duì)象。
          例如:

          <Script>
          with (document) {
               write (
          "你的瀏覽器信息:<OL>");
               write (
          "<LI>代碼:"+navigator.appCodeName);
               write (
          "<LI>名稱(chēng):"+navigator.appName);
               write (
          "<LI>版本:"+navigator.appVersion);
               write (
          "<LI>語(yǔ)言:"+navigator.language);
               write (
          "<LI>編譯平臺(tái):"+navigator.platform);
               write (
          "<LI>用戶表頭:"+navigator.userAgent);
          }

          </Script>


          例如:

          <Script>
          if (document.all) {
              document.write(
          "你的瀏覽器是:MSIE");
          }
              else {
              document.write(
          "你的瀏覽器是:Navigator");
          }

          </Script> 

          Screen
          基本JavaScript的Screen屏幕對(duì)象

          • screen 屏幕對(duì)象 反映了當(dāng)前用戶的屏幕設(shè)置。
          • width 返回屏幕的寬度(像素?cái)?shù))。
          • height 返回屏幕的高度。
          • availWidth 返回屏幕的可用寬度(除去了一些不自動(dòng)隱藏的類(lèi)似任務(wù)欄的東西所占用的寬度)。
          • availHeight 返回屏幕的可用高度。
          • colorDepth 返回當(dāng)前顏色設(shè)置所用的位數(shù) - 1:黑白;8:256色;16:增強(qiáng)色;24/32:真彩色


            下面是英文的Navigator瀏覽器的屏幕對(duì)象:

          • availHeight:minus permanent or semipermanent user interface features displayed by the operating system:such as the Taskbar on Windows.  
          • availWidth:Specifies the width of the screen, in pixels, minus permanent or semipermanent user interface:features displayed by the operating system, such as the Taskbar on Windows.  
          • colorDepth:The bit depth of the color palette, if one is in use; otherwise, the value is derived from screen.pixelDepth.  
          • height:Display screen height.  
          • pixelDepth:Display screen color resolution (bits per pixel).  
          • width:Display screen width.

          History
          JavaScript中的History歷史對(duì)象包含了用戶已瀏覽的 URL 的信息,是指歷史對(duì)象指瀏覽器的瀏覽歷史。鑒于安全性的需要,該對(duì)象收到很多限制,現(xiàn)在只剩下下列屬性和方法。History歷史對(duì)象有l(wèi)ength這個(gè)屬性,列出歷史的項(xiàng)數(shù)。JavaScript 所能管到的歷史被限制在用瀏覽器的“前進(jìn)”“后退”鍵可以去到的范圍。本屬性返回的是“前進(jìn)”和“后退”兩個(gè)按鍵之下包含的地址數(shù)的和。

          History歷史對(duì)象并有以下方法

          • back() 后退,跟按下“后退”鍵是等效的。
          • forward() 前進(jìn),跟按下“前進(jìn)”鍵是等效的。
          • go() 用法:history.go(x);在歷史的范圍內(nèi)去到指定的一個(gè)地址。如果 x < 0,則后退 x 個(gè)地址,如果 x > 0,則前進(jìn) x 個(gè)地址,如果 x == 0,則刷新現(xiàn)在打開(kāi)的網(wǎng)頁(yè)。history.go(0) 跟 location.reload() 是等效的。


          posted on 2007-12-03 18:43 湘江夜游神 閱讀(505) 評(píng)論(0)  編輯  收藏 所屬分類(lèi): JavaScript

          <2007年12月>
          2526272829301
          2345678
          9101112131415
          16171819202122
          23242526272829
          303112345

          留言簿(5)

          隨筆分類(lèi)

          隨筆檔案

          文章分類(lèi)

          文章檔案

          新聞分類(lèi)

          最新評(píng)論

          Locations of visitors to this page

          主站蜘蛛池模板: 循化| 景宁| 萍乡市| 晋宁县| 阿鲁科尔沁旗| 汝阳县| 寻乌县| 威海市| 久治县| 启东市| 璧山县| 城步| 阜宁县| 莲花县| 宁波市| 休宁县| 广宁县| 谢通门县| 泰州市| 兴和县| 稷山县| 常州市| 黄骅市| 安国市| 惠水县| 枣阳市| 尉氏县| 晋宁县| 芜湖市| 洪洞县| 琼中| 万源市| 塔河县| 永胜县| 依兰县| 岗巴县| 敦化市| 华阴市| 六枝特区| 彰化县| 调兵山市|