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

📄 day4_10.html

📁 java 的高级教程~~ 哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈~晕~打字很累的
💻 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><script language="JavaScript"><!-- hide me// timedAlert// this just calls a function timedAlert(){	var the_timeout = setTimeout("alertAndRedirect();", 3000);}function alertAndRedirect(){	alert('OK! Exhale!');	window.location.replace("day3_2.html");}// show me --></script></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="591" valign="top" align="left" rowspan="2"><small><small><br>        </small></small><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>        <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 + -