⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 day5_4.html

📁 JAVASCRIPT 高级编程
💻 HTML
📖 第 1 页 / 共 2 页
字号:
  <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">修正错误</font></strong> 
      <p><font size="3">找到错误,有时侯虽然很难,却只是第一步。然后你必须清除<br>
        错误。下面是一些在清除错误时应该做的一些事:</font></p>
      <p><font size="3"><strong>首先拷贝你的程序</strong></font></p>
      <blockquote> 
        <p><font size="3">有些错误很难清除。实际上,有时在根除错误时,<br>
          你会破坏整个程序 - 一个小错误使你疯狂。在开始<br>
          调试前保存你的程序是确保错误不会利用你的最好<br>
          方法。</font></p>
      </blockquote>
      <p><font size="3"><strong>一次修正一个错误</strong></font></p>
      <blockquote> 
        <p><font size="3">如果你知道有好几个错误,应该修正一个,检验其<br>
          结果,再开始下一个。一次修正许多错误而不检验<br>
          你的工作只会招致更多的错误。</font></p>
      </blockquote>
      <p><strong>警惕迷惑性错误</strong></p>
      <blockquote> 
        <p>有时你知道存在一个错误,但不真正知道为什么。<br>
          假设有一个变量“index”,由于某种原因“index”<br>
          总比你期望的小1。你可以做下面两件事中的一件:<br>
          在那儿坐一会儿,解决它为什么变小了,或只是耸<br>
          耸肩;在使用“index”之前加1,然后继续进行。后<br>
          一种方法称为迷惑编程。当你开始思考“究竟是怎<br>
          么了 - 为什么index是2而不是3呢?好吧...我现在<br>
          先让它正常工作,以后再修改错误。”时,你正在<br>
          把一块护创膏布贴到一处潜在的硬伤上。</p>
        <p>迷惑编程可能在短期内有用,但是你可以看到长期<br>
          的厄运 - 如果你没有完全理解你的代码到可以真正<br>
          清除错误的程度,那个错误将会回来困扰你。它或<br>
          者以另一种你不能解决的怪异错误的方式回来,或<br>
          者当下一个可怜的被诅咒的灵魂读你的代码时,他<br>
          会发现你的代码非常难以理解。</p>
      </blockquote>
      <p><strong>寻找小错误</strong></p>
      <blockquote> 
        <p>有时侯,对程序员来说,剪切和粘贴代码的能力是<br>
          一种很坏的事。通常,你会在一个函数中写一些<br>
          JavaScript代码,然后把它们剪切和粘贴到另一个<br>
          函数中。如果第一个函数有问题,那么现在两个函<br>
          数都有问题。我并不是说你不应该剪切和粘贴代码。<br>
          但是错误会以某种方式繁殖,如果你发现了一个<br>
          错误,你就应该寻找与其相似的其它错误。(或者<br>
          在制作它的若干版本之前确切知道会发生什么。)<br>
          变量名拼写错误在一段JavaScript代码中会突然多<br>
          次出现 - 在一个地方把the_name错拼成teh_name,<br>
          你就有机会在其它地方发现这个错误。</p>
      </blockquote>
      <p><strong>如果所有其它的方法都失败了</strong></p>
      <blockquote> 
        <p>如果你正坐在那儿盯着一个错误,并且不能指出是<br>
          怎么回事(或者根本没有发现错误,但是因为程序<br>
          不能正确运行,你知道存在错误),你最好从计算<br>
          机前走开。去读一本书,在角落散散步,或者拿一<br>
          杯可口的饮料 - 做些事,任何事,但不要去想程序<br>
          或问题。这种技术在某种情况下叫做“酝酿”,效<br>
          果非常好。在你稍做休息和放松后,再试着找出<br>
          错误。你会得到一幅比较清晰的景象。“酝酿”起<br>
          作用是因为它使你从思维混乱中解脱出来。如果沿<br>
          着一条错路走太远,你有时会发现无法转身。这种<br>
          情况下最好开辟一条新路。我知道这会令人发火,<br>
          但确实有效。真的!</p>
      </blockquote>
      <p><strong>如果上面的方法还不成功...</strong></p>
      <blockquote> 
        <p>请求别人的帮助。有时你的思想会形成定式,只有<br>
          换一种眼光才能洞察问题之所在。在结构化编程环<br>
          境中,程序员们定期地互相复查别人的代码。这可<br>
          以适当地叫做“代码复查”,不仅可以帮助消除<br>
          错误,还可以得到更好的代码。不要怕把你的<br>
          JavaScript代码给别人看,它会使你成为更好的<br>
          JavaScript程序员。</p>
      </blockquote>
      <p><strong>但是消除错误的绝对最好的办法是...</strong></p>
      <blockquote> 
        <p>一开始就创建没有错误的代码。<a href="day5_5.html">&gt;&gt;</a></p>
      </blockquote>
      <p align="left"><font face="宋体" size="3" color="#000000"><strong>JavaScript高级教程</strong></font><font color="#FF0000" face="宋体" size="3"><br>
        </font><font color="#FF3300" size="3">第一页</font><font size="3"> </font><a href="day5_1.html"><font size="3" face="verdana, arial, geneva, sans-serif">JavaScript</font><font size="3">高级教程</font><font size="3" face="verdana, arial, geneva, sans-serif">- 
        </font><font size="3">第</font><font size="3" face="verdana, arial, geneva, sans-serif">5</font><font size="3">天</font></a><font size="3"> 
        <br>
        </font><font color="#FF3300" size="3">第二页 </font><font size="3"><a href="day5_2.html">打印变量</a><br>
        </font><font color="#FF3300" size="3">第三页 </font><font size="3"><a href="day5_3.html">一般性程序错误</a><br>
        </font><font color="#FF3300" size="3">第四页 </font><font size="3">修正错误<br>
        </font><font color="#FF3300" size="3">第五页 </font><font size="3"><a href="day5_5.html">好的编程实践</a><br>
        </font><font color="#FF3300" size="3">第六页 </font><font size="3"><a href="day5_6.html">按速度优化JavaScript代码</a><br>
        </font><font color="#FF3300" size="3">第七页 </font><a href="day5_7.html"><font size="3">下面讲什么?</font></a></p>
      <p align="left">[<a href="day1_1.html">第1课</a>][<a href="day2_1.html">第2课</a>][<a href="day3_1.html">第3课</a>][<a href="day4_1.html">第4课</a>][第5课]</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.&nbsp; All rights reserved. 
 </span> 
</center>
</body>
<!-- #EndTemplate --></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -