亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

JS判斷瀏覽器之Navigator對象

 更新時(shí)間:2007年01月28日 00:00:00   作者:  
The Navigator Object
導(dǎo)航對象
The JavaScript Navigator object contains all information about the visitor's browser. We are going to look at two properties of the Navigator object:
JS導(dǎo)航對象包含所有有關(guān)訪問這者瀏覽器的信息。我們將看看兩個(gè)導(dǎo)航對象的產(chǎn)物:

appName -  holds the name of the browser
appName - 含瀏覽器的名稱 
appVersion - holds, among other things, the version of the browser
appVersion - 瀏覽器版本 
Example
舉例 

[Ctrl+A 全選 注:引入外部Js需再刷新一下頁面才能執(zhí)行]

The variable browser in the example above holds the name of the browser, i.e. "Netscape" or "Microsoft Internet Explorer".
上面例子中變量brower(瀏覽器)被賦加了瀏覽器的名稱,網(wǎng)景或是IE(或其他)

The appVersion property in the example above returns a string that contains much more information than just the version number, but for now we are only interested in the version number. To pull the version number out of the string we are using a function called parseFloat(), which pulls the first thing that looks like a decimal number out of a string and returns it.
上面例子中的appVersion屬性返回一串包含比版本號更多的信息字符,但現(xiàn)在我們只要版本號。要從字符串中提出版本號我們使用一個(gè)叫parseFloat()的函數(shù)來返回?cái)?shù)字。

IMPORTANT! The version number is WRONG in IE 5.0 or later! Microsoft start the appVersion string with the numbers 4.0. in IE 5.0 and IE 6.0!!! Why did they do that??? However, JavaScript is the same in IE6, IE5 and IE4, so for most scripts it is ok.
(有關(guān)JS返回IE版本號的問題)

Example
舉例
The script below displays a different alert, depending on the visitor's browser:
根據(jù)訪問者的瀏覽器,(不同的瀏覽器)下面的腳本將顯示不同的警示:


[Ctrl+A 全選 注:引入外部Js需再刷新一下頁面才能執(zhí)行]

相關(guān)文章

最新評論