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

📄 day4_10.html

📁 JAVASCRIPT 高级编程
💻 HTML
📖 第 1 页 / 共 2 页
字号:
  </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"> </font></p>
      <table width="449">
        <tr> 
          <td width="445"> <font face="helvetica, arial, sans-serif" size="2"></font><font size="3">这就是我们迄今为止学到的获取图象对象的手段:</font></td>
        </tr>
      </table>
      <pre><font face="verdana, arial" size="2">function simpleSwap()
{
	var the_image = prompt(&quot;change parrot or cheese&quot;,&quot;&quot;);
	var the_image_name = &quot;window.document.&quot; + the_image;
	var the_image_object = eval(the_image_name);
	the_image_object.src = &quot;ant.gif&quot;;
}</font><font face="verdana, arial" size="1">
</font></pre>
      <div align="left"> 
        <table width="448">
          <tr> 
            <td width="444"> <font face="helvetica, arial, sans-serif" size="3"></font><font size="3">从这里延伸一下,你也可以通过图象的名字在图象关联数组<br>
              中引用图象,比如:<tt><font face="verdana, arial">window.document.images<br>
              [&quot;parrot&quot;].src</font></tt></font><font size="3" face="verdana, arial">. 
              </font><font size="3">这就象通过数组的下标引用图象一样,如<br>
              <font face="verdana, arial"><tt>window.document.images[0].src</tt>. 
              </font>所以,上面的代码可<br>
              以重新写成:</font></td>
          </tr>
        </table>
      </div>
      <pre><font face="verdana, arial" size="2">function simpleSwap()
{
	var the_image = prompt(&quot;change parrot or cheese&quot;,&quot;&quot;);
	window.document.images[the_image].src = &quot;ant.gif&quot;;
}</font></pre>
      <table width="444">
        <tr> 
          <td width="440"> <font face="helvetica, arial, sans-serif" size="3"></font><font size="3">你可以用这种技巧获得你的各种对象。如果在一个表单里有<br>
            一个文本框,象这样: 
            <blockquote> 
              <pre>
          <font face="verdana, arial"></font>
<font face="verdana, arial">&lt;form name=&quot;the_form&quot;&gt;
&lt;input type=&quot;text&quot; name=&quot;the_text_box&quot;&gt;
&lt;/form&gt;
</font></pre>
            </blockquote>
            </font> 
            <p><font size="3"> <font face="verdana, arial"></font>你可以用这个来改变文本框里的文本:</font></p>
            <p>window.document.forms[&quot;the_form&quot;].elements[&quot;the_text_box&quot;].value 
              = &quot;hello!&quot;;</p>
            <p><font size="3">现在你已经知道了好几种获取和改变对象信息的途径了。在<br>
              上面的例子里,我们可以用四种手段来设置文本框的文本:</font>
          </td>
        </tr>
      </table>
      <blockquote> 
        <pre><big>
</big>var the_form_name = &quot;the_form&quot;;
var the_element_name = &quot;the_text_box&quot;;
</pre>
      </blockquote>
      <ol>
        <li>window.document.forms[0].elements[0].value = &quot;hello!&quot;; </li>
        <li>window.document.forms[the_form_name].elements[the_element_name].value 
          = &quot;hello!&quot;; </li>
        <li>window.document.the_form.the_text_box.value = &quot;hello!&quot;; 
        </li>
        <li>var the_element_string = &quot;window.document.&quot; + the_form_name 
          + &quot;.&quot; + the_element_name; var the_element = eval(the_element_string); 
          the_element_string.value = &quot;hello!&quot;; </li>
      </ol>
      <table width="445">
        <tr> 
          <td width="441"><font size="3">具体到你用哪个方法也许取决于你的心情以及你能想起来用<br>
            那一个。 
            <p><font face="verdana, arial"></font>这就是我们今天的课程,我们来复习一下。<a href="day4_11.html">&gt;&gt;</a>
            </font></td>
        </tr>
      </table>
      <p align="left"><font face="宋体" size="3" color="#000000"><strong>JavaScript高级教程</strong></font><font color="#FF0000" face="宋体" size="3"><br>
        </font><font size="3"><font color="#FF3300">第一页</font> <a href="day4_1.html"><font face="verdana, arial, geneva, sans-serif">JavaScript</font>高级教程<font face="verdana, arial, geneva, sans-serif">- 
        </font>第<font face="verdana, arial, geneva, sans-serif">4</font>天</a> 
        <br>
        <font color="#FF3300">第二页 </font><a href="day4_2.html">图象映射与<font face="verdana, arial, geneva, sans-serif">JavaScript</font></a><font face="verdana, arial, geneva, sans-serif"><br>
        </font><font color="#FF3300">第三页 </font><a href="day4_3.html">预装图象 - 是什么<font face="verdana, arial, geneva, sans-serif">?</font></a><font face="verdana, arial, geneva, sans-serif"><br>
        </font><font color="#FF3300">第四页 </font><a href="day4_4.html">预装图象 - 怎么做?</a><font face="verdana, arial, geneva, sans-serif"><br>
        </font><font color="#FF3300">第五页 </font><a href="day4_5.html">对象的优点</a><br>
        <font color="#FF3300">第六页 </font><a href="day4_6.html">创建你自己的对象</a><br>
        <font color="#FF3300">第七页 </font><a href="day4_7.html">你的面向对象的虚拟宠物</a><br>
        <font color="#FF3300">第八页 </font><a href="day4_8.html">计算字符串</a><br>
        <font color="#FF3300">第九页 </font><a href="day4_9.html">获取难以索引的对象</a><br>
        <font color="#FF3300">第十页 </font>另一种获取难以索引的对象的手段<br>
        <font color="#FF3300">第十一页 </font><a href="day4_11.html">第四天课程复习</a></font></p>
      <p>[<a href="day1_1.html">第1课</a>][<a href="day2_1.html">第2课</a>][<a href="day3_1.html">第3课</a>][第4课][<a href="day5_1.html">第5课</a>]</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 + -