📄 day3_8.html
字号:
<td colspan="2">-<font color="#000000"><a href="../../1-download/page3.htm">网站设计</a></font></td>
</tr>
<tr bgcolor="#FFFFFF">
<td colspan="2">-<font color="#000000"><a href="../../1-download/page4.htm">电子商务</a></font>
</td>
</tr>
<tr>
<td colspan="2" align="center" bgcolor="#666699"><a href="../../1-teach/index.htm"><font color="#FFFFFF">实用技巧</font></a></td>
</tr>
<tr bgcolor="#FFFFFF">
<td colspan="2">-<a href="../../1-teach/internet/index.htm">Internet应用</a></td>
</tr>
<tr bgcolor="#FFFFFF">
<td colspan="2">-<a href="../../1-teach/photoshop/index.html">Photoshop</a></td>
</tr>
<tr bgcolor="#FFFFFF">
<td colspan="2">-<a href="../../1-teach/flash/page1.html">Flash</a></td>
</tr>
<tr bgcolor="#FFFFFF">
<td colspan="2">-<a href="../../1-teach/asp/index.html">ASP</a></td>
</tr>
<tr bgcolor="#FFFFFF">
<td colspan="2">-<a href="../../1-teach/php/index.html">PHP</a></td>
</tr>
<tr bgcolor="#FFFFFF">
<td colspan="2">-<a href="../../1-teach/java/index.htm">Java</a></td>
</tr>
<tr bgcolor="#FFFFFF">
<td colspan="2">-<a href="../../1-teach/vb/index.htm">VB</a></td>
</tr>
<tr bgcolor="#FFFFFF">
<td colspan="2">-<a href="../../1-teach/c/index.htm">C、C++</a></td>
</tr>
<tr bgcolor="#FFFFFF">
<td colspan="2">-<a href="../../1-backend/database/php_mysql/index.html">PHP/MySQL</a></td>
</tr>
<tr bgcolor="#FFFFFF">
<td colspan="2"><a href="../../1-backend/cgi_perl/perl_beginner/index.html">-Perl</a>
</td>
</tr>
<tr bgcolor="#FFFFFF">
<td colspan="2">-<a href="../../1-teach/other/index.htm">其它</a> </td>
</tr>
<tr>
<td colspan="2" bgcolor="#666699">
<div align="center"><font color="#FFFFFF">更多教程</font></div>
</td>
</tr>
<tr bgcolor="#FFFFFF">
<td colspan="2" height="17"><a href="../../1hdml/index.html">-HDML</a></td>
</tr>
<tr bgcolor="#FFFFFF">
<td colspan="2" height="23"><font face="宋体"><a href="../../1-backend/database/course/day1_1.html">-网络数据库</a></font></td>
</tr>
<tr bgcolor="#FFFFFF">
<td colspan="2" height="14"><a href="../../1-backend/protocols/ping/index.html"><font face="arial, helvetica, sans-serif">-ping</font></a></td>
</tr>
<tr bgcolor="#FFFFFF">
<td colspan="2" height="20"><a href="../../1-backend/cgi_perl/search_engine/index.html">-创建搜索引擎</a></td>
</tr>
<tr bgcolor="#FFFFFF">
<td colspan="2" height="16">-<a href="../../1adobe/GoLive/index.html">Adobe GoLive</a></td>
</tr>
<tr bgcolor="#FFFFFF">
<td colspan="2"><a href="../../1-backend/cgi_perl/templates/index.html">-模板</a></td>
</tr>
<tr bgcolor="#666699">
<td colspan="2" align="center"><font color="#FFFFFF">合作伙伴</font></td>
</tr>
<tr bgcolor="#FFFFFF">
<td colspan="2" align="left">-<a href="http://www.5dmedia.com/" target="_blank">5D精英网</a></td>
</tr>
<tr align="center" bgcolor="#FFFFFF">
<td colspan="2"> <img src="../../Library/front_monkey.gif" width="59" height="68"></td>
</tr>
</tbody>
</table>
<!-- #EndLibraryItem --> </td>
<!-- End of headlines (column 1: left column) --> <!-- Gutter between columns 1 and 2 -->
<td width="10" height="794"><img src="http://www.sohu.com/images/pixel.gif" width=10></td>
<!-- Search box and directories (columns 2 and 3: middle columns, combined into one) -->
<td align=center valign=top width="558">
<div align="left"><!-- #BeginEditable "1" -->
<title>JavaScrip高级教程</title>
<strong>第八页:<font size="3" face="宋体">如何识别用户的浏览器</font></strong>
<p><font size="2"></font><font size="3"><font face="宋体">每种浏览器除了有Document(文件)对象之外还有<br>
Navigator对象,Navigator有两个属性包含着你所使用的浏览<br>
器类型的所有信息:<tt>appName</tt> and <tt>appVersion</tt>. </font></font></p>
<font size="3">
<p><font face="宋体">appName是浏览器的类型,如果你用的是Netscape的某种版本,<br>
你的Javascript中可以加入这样一行:<br>
var the_browser_name = navigator.appName;<br>
<br>
则<tt>the_browser_name</tt>的值是 "Netscape"。对于 MSIE,<br>
则<tt>the_browser_name</tt>是"Microsoft Internet Explorer" 。所以<br>
如果你想知道某人用的何种浏览器就可以用<tt>appName</tt>。 </font></p>
<p><font face="宋体"><tt>appVersion</tt>是浏览器的版本.其显示信息例子:"4.03 [en] <br>
(Win95; I)"。意思是Netscape version 4.03, English <br>
International, for Win95/NT。将版本号从中提取出来的办法<br>
很简单:只需抓取第1个数字即可。最快捷的办法就是使用函<br>
数<tt>parseFloat()</tt>,它将字符串中第1个数字符号提取出来并返回<br>
数值:<br>
<br>
var the_browser_version = navigator.appVersion;<br>
var the_version_number = parseFloat(the_browser_version);<br>
<br>
</font>除了版本号之外<font face="宋体"><tt>appVersion</tt></font>别的信息<font face="宋体">都不是很确切。不同的浏<br>
览器可能会在该字符串中加入各种希奇古怪的东西。 </font></p>
<p><font face="宋体">现在我们利用以上获得的信息作一些有用的事。点击下面的按<br>
钮你会看到Navigator最直观的用途。 </font></p>
<form>
<p><font face="宋体">
<input type="button" value="The browser doctor says:" onClick="browserSizeUp();" name="button">
</font></p>
</form>
<p><font face="宋体">以下是用到的两个函数。点按钮调用<tt>browserSizeUp()</tt>:</font></p>
</font>
<p><font face="宋体"><br>
function browserSizeUp()<br>
{<br>
var browser = navigator.appName;<br>
var version = versionNumber();<br>
var the_string = browser + " " + version;<br>
<br>
if ((browser == "Netscape" || browser == "Microsoft
Internet Explorer") &&<br>
(version >= 4)) <br>
<br>
{<br>
alert("The browser doctor says: " + the_string + "?
Now that's a beautiful browser!");<br>
} else {<br>
alert("The browser doctor says: " + the_string + ", Hmm.
Maybe it's time to upgrade.");<br>
}<br>
}<br>
<br>
<br>
function versionNumber() {<br>
// return version number (e.g., 4.03)<br>
return parseFloat(navigator.appVersion)<br>
}<br>
<br>
</font></p>
<p><font size="3"><font face="宋体">会发生什么呢?如果我们检测到的用户的浏览器版本大于4,则<br>
显示一个提示框,否则就显示另外的提示框。在实际的应用中<br>
你常常需要用到<tt>document.writeln()</tt> 生成适应不同浏览器的<br>
HTML。</font></font></p>
<font size="3">
<p><font face="宋体">用户所看到的页面内容取决于它所使用的浏览器,浏览器的<br>
版本。随着浏览器版本不断增多,又分别应用于不同的操作<br>
平台,你要想浏览器的变化随时保持同步的困难不断加大。 </font></p>
<p><font face="宋体">所幸的是还有一种办法可以避免这个问题。<a href="day3_9.html">>></a></font></p>
</font>
<p><font face="宋体" size="3" color="#000000"><strong>JavaScript高级教程</strong></font><font color="#FF0000" face="宋体" size="3"><br>
</font><font face="宋体"><font color="#FF0000">第一页</font> <a href="day3_8.html">Javascript高级教程
- 第三课</a><br>
<font size="3"><font color="#FF0000">第二页</font> <a href="day3_2.html">如何给事件定时</a><br>
<font color="#FF0000">第三页</font> <a href="day3_3.html">定时循环的概念</a><br>
<font color="#FF0000">第四页</font> <a href="day3_4.html">定时循环的做法</a><br>
<font color="#FF0000">第五页</font> <a href="day3_5.html">一个Javascript编写的时钟</a><br>
<font color="#FF0000">第六页</font> <a href="day3_6.html">给定时器加入变量</a><br>
<font color="#FF0000">第七页</font> <a href="day3_7.html">识别用户的浏览器</a><br>
<font color="#FF0000">第八页</font> 如何识别用户的浏览器<br>
<font color="#FF0000">第九页</font> <a href="day3_9.html">对象和方法的识别</a><br>
<font color="#FF0000">第十页</font> <a href="day3_10.html">History对象</a></font></font></p>
<p>[<a href="day1_1.html">第1课</a>][<a href="day2_1.html">第2课</a>][第3课]<font size="3">[<a href="day4_1.html">第4课</a>][<a href="day5_1.html">第5课</a>]</font></p>
<!-- #EndEditable --></div>
</td>
<!-- End of search box and directories (columns 2 and 3: middle columns, combined into one) -->
<!-- Gutter between columns 3 and 4 --> <!-- Other stuff (column 4: right column) -->
<!-- End of other stuff (column 4: right column) --> </tr>
</table>
<!-- End of table surrounding page contents -->
<hr noshade size=1 width=700>
<span class=eng><br>
Copyright (C) 1998-2000 Internet Technologies China. All rights reserved.
</span>
</center>
</body>
<!-- #EndTemplate --></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -