📄 day3_9.html
字号:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312-80">
<style type="text/css">
<!--
a:link { color: blue; text-decoration: none}
a:visited { color: purple; text-decoration: none}
a:hover { color: #CC0033; text-decoration: underline}
-->
</style>
<title>JavaScript高级教程</title>
</head>
<body topmargin="1" leftmargin="2">
<table border="0" width="591" cellspacing="0">
<tr>
<td bgcolor="#ffff99" width="451">JavaScript高级教程 - 第三课</td>
</tr>
<tr>
<td bgcolor="#FF6600" width="451"><a href="mailto:thau@wired.com">Thau</a></td>
</tr>
</table>
<div align="left">
<table border="0" width="630" cellspacing="0">
<tr>
<td width="458" valign="top" align="left" rowspan="2"><small><small><br>
</small></small><strong>第九页:<font size="3" face="宋体">对象和方法的识别</font></strong>
<p><font size="3"><font face="宋体">最佳的方法是你先确定某一段代码具备什么功能,然后搞清楚<br>
浏览器具备什么功能。 </font></font></p>
<font size="3">
<p><font face="宋体">例如,我们知道有些浏览器支持图片替换,有些则不行。好在<br>
可以检测浏览器是否具备这种功能:只需检测浏览器是否具<br>
有<tt>document.images对象即可:</tt> </font></p>
<blockquote>
<pre><font face="宋体">if (document.images)
{
do lots of image swap stuff
}
</font></pre>
</blockquote>
<p><font face="宋体">这样图片替换的代码就只会在支持图片替换的浏览器中才执行。 </font></p>
<p><font face="宋体">这种技巧还可以用于方法和函数。不是所有的;浏览器都有各<br>
种方法。例如,在Netscape 4中,你可以用<tt>window.moveTo()</tt>方<br>
法将窗口在屏幕中移动,如果你想在调用该方法之前先检测浏<br>
览器是否具有这种方法,则: </font></p>
<blockquote>
<pre><font face="宋体">if (window.moveTo)
{
make that window fly
}
</font></pre>
</blockquote>
</font>
<p><font size="3"><font face="宋体">确保浏览器支持某项功能后再调用该功能可以避免很多无谓的<br>
脚本错误。使用浏览器功能测试的方法而不是浏览器类型测试<br>
的方法可以使你的网页内容同各种平台上各种类型各种版本的<br>
浏览器都保持同步。<a href="day3_10.html">>></a></font></font></p>
<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_9.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> <a href="day3_8.html">如何识别用户的浏览器</a><br>
<font color="#FF0000">第九页</font> 对象和方法的识别<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>
<hr align="left">
<!--webbot bot="Include" U-Include="../../copyright.html" TAG="BODY" startspan -->
<p><font face="verdana, arial, geneva, sans-serif" size="2"><a href="http://phtshop.yeah.net" target="_top">本文根据
网猴 相关文章改编,版权归原作者所有。</a> </font><font color="#000000"><span class="smallfont"></span></font></p>
<!--webbot bot="Include" endspan i-checksum="15926" --> </td>
</tr>
<tr> </tr>
</table>
</div>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -