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

📄 day2_4.html

📁 不错的javascript学习资料适合于刚刚学习javascirpt的出学者
💻 HTML
📖 第 1 页 / 共 2 页
字号:
  <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 face="宋体" size="3">第四页:字符串的魔力</font></strong> 
          <p><font face="宋体" size="3">如前一节所提,引号间的字符都称为字符串,无论单双引号。<br>
            就如变量可为数字一样,它也可为字符串。因此可说:</font></p>
          <p><font face="宋体" size="3">var nice_monkey = &quot;The monkey smiles 
            at you and recites Shakespeare.&quot;;<br>
            <br>
            var bad_monkey = &quot;The monkey scowls at you and burps.&quot;;<br>
            <br>
            </font></p>
          <p><font face="宋体" size="3">申报变量时即给变量赋值,使它等于这些字符串,于是当你想<br>
            写这些字符串时,你可写:</font></p>
          <p><font face="宋体" size="3"><br>
            document.writeln(nice_monkey);<br>
            <br>
            </font></p>
          <p><font face="宋体" size="3">这里是可用字符串做事的例子。</font></p>
          <p><font face="宋体" size="3">仔细看一看源码,你将常会发现一些新鲜,有趣的事。</font></p>
          <p><font face="宋体" size="3">看以下新鲜之处:</font></p>
          <p><font face="宋体" size="3"><br>
            var monkey = prompt(&quot;What's the monkey's name?&quot;, &quot;The 
            monkey&quot;);<br>
            <br>
            </font></p>
          <p><font face="宋体" size="3">这里我们称为用户反馈提示方式,当它被调用时,启动一个对<br>
            话框请求用户输入信息。用户完成后敲OK返回信息。在上行中<br>
            返回信息放入其变量中。 </font></p>
          <p><font face="宋体" size="3">注意该提示方式有两个变量,且都是字符串。第一个在对话框<br>
            输入区上面显示,本例中它是:“What's the monkey's <br>
            name?”。本例中第二个参数&quot;The monkey&quot;,放置输入框的缺<br>
            省值。如果你不想要缺省值,则在第二个参数加上引号,就象<br>
            这样:</font></p>
          <p><font face="宋体" size="3"><br>
            var monkey = prompt(&quot;What's the monkey's name?&quot;, &quot;&quot;);<br>
            <br>
            </font></p>
          <p><font face="宋体" size="3">下一行是直接变量分配,就象此前我们看到的:</font></p>
          <p><font face="宋体" size="3"><br>
            var techy_monkey = monkey + demanding + tech;<br>
            <br>
            </font></p>
          <p><font face="宋体"><font size="3">该行介绍了一个字符串操作器:累加标记。当两个字符串间出<br>
            现累加标记时,则这两个变量出现在同一字符串中,这称为<br>
            “<a href="http://www.pcwebopedia.com/concatenate.htm" target="_blank">连锁</a>”。于是上行创造了一个新的变量称为<tt>techy_monkey<br>
            </tt></font><tt><font size="4">含有包含上述三个变量的字符串。换一句话说,其结果即是<br>
            </font></tt><font size="3">&quot;<tt>The monkey</tt>&quot; + &quot;<tt>demands, 
            no, insists upon receiving</tt>&quot; + <br>
            &quot;<tt>a computer that won't crash, and a homemade browser!</tt>&quot;</font></font></p>
          <p><font face="宋体" size="3"><br>
            var techy_monkey = monkey + demanding + tech;<br>
            <br>
            于是也可说:</font></p>
          <p><font face="宋体" size="3"><br>
            var techy_monkey = &quot;The monkey demands, no, insists upon<br>
            receiving a computer <br>
            <br>
            that won't crash, and a homemade browser!&quot;;<br>
            <br>
            </font></p>
          <p><font face="宋体" size="3">下面一段显示更多的使用字符串的诀窍。其工作原理是相同<br>
            的,我们只看三行:</font></p>
          <p><font face="宋体" size="3"><br>
            var italic_hippy = hippy_monkey.italics();<br>
            <br>
            var shouting_hippy= hippy_monkey.toUpperCase();<br>
            <br>
            var red_bold_tech = bold_tech.fontcolor('red');<br>
            <br>
            第一行是说:“使该字符串包含变量以斜体显示”,这实际上<br>
            即是:</font></p>
          <p><font face="宋体" size="3"><br>
            var italic_hippy = &quot;&lt;i&gt;&quot; + hippy_monkey + &quot;&lt;/i&gt;&quot;;<br>
            <br>
            </font></p>
          <p><font face="宋体" size="3">但看起来要好的多!今后在JavaScript写<tt>document.writeln<br>
            (italic_hippy)</tt>时,你得到的是斜体显示的字符。</font></p>
          <p><font face="宋体" size="3">下一行讲述的技巧是在HTML中实现不了的,它使得<tt>hippy_monkey</tt><br>
            中所有字符以大写显示</font></p>
          <p><font face="宋体" size="3">第三行显示改变字符串属性的例子。。所有的字符具有颜色,<br>
            你可用<tt>string.fontcolor('new color');</tt>命令改变其颜色。也<br>
            可这样作:</font></p>
          <p><font face="宋体" size="3"><br>
            var red_bold_tech = &quot;&lt;font color='red'&gt;&quot; + bold_tech 
            + &quot;&lt;/font&gt;&quot;;<br>
            <br>
            但它阅读起来不如这样容易: </font></p>
          <p><font face="宋体" size="3">var red_bold_tech = bold_tech.fontcolor('red');<br>
            <br>
            本例中除本行外你还可看到其他的应用:</font></p>
          <p><font face="宋体" size="3">document.writeln(bold_tech + &quot;&lt;br&gt;&quot;);<br>
            <br>
            它除替代显示一字符串外,还连接两个字符串然后显示结果。<br>
            也可写成两行,象这样:</font></p>
          <p><font face="宋体" size="3">var broken_bold = bold_tech + &quot;&lt;br&gt;&quot;;<br>
            <br>
            document.writeln(broken_bold);<br>
            <br>
            </font></p>
          <p><font face="宋体" size="3">但这要创建另一个变量,并不必要的写另一行。</font></p>
          <p><font face="宋体" size="3">现在我们已学习了所有的关于变量和字符串知识,<a href="day2_5.html">请做一个练习</a></font></p>
          <p align="left"><font face="宋体" size="3" color="#000000"><strong>JavaScript教程</strong></font><font color="#FF0000" face="宋体" size="3"><br>
            </font><font face="宋体" size="3"><font color="#FF0000">第一页</font>:<a href="day2_1.html">第二天课程简介</a><br>
            <font color="#FF0000">第二页</font>:<a href="day2_2.html">变量介绍</a><br>
            <font color="#FF0000">第三页</font>:<a href="day2_3.html">首个变量例子的程序主体</a><br>
            <font color="#FF0000">第四页</font>:字符串的魔力<br>
            <font color="#FF0000">第五页</font>:<a href="day2_5.html">变量练习</a><a href="day2_4.html"> 
            </a></font><font face="宋体" size="3"><br>
            <font color="#FF0000">第</font><font face="宋体" size="3"><font color="#FF0000">六</font></font><font color="#FF0000">页</font>:<a href="day2_6.html">if-then子句</a><br>
            <font color="#FF0000">第</font><font face="宋体" size="3"><font color="#FF0000">七</font></font><font color="#FF0000">页</font>:<a href="day2_7.html">if-then语句的例子</a> 
            <br>
            <font color="#FF0000">第八页</font>:<a href="day2_9.html">链结事件</a><br>
            <font color="#FF0000">第</font><font face="宋体" size="3"><font color="#FF0000">九</font></font><font color="#FF0000">页</font>:<a href="day2_10.html">图片交换</a><br>
            <font color="#FF0000">第十页</font>:<a href="day2_12.html">复习</a><br>
            </font></p>
          <p align="left"><font face="宋体" size="3">[<a href="index.html">第1课</a>][第2课][<a href="day3_1.html">第3课</a>][<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.&nbsp; All rights reserved. 
 </span> 
</center>
</body>
<!-- #EndTemplate --></html>

⌨️ 快捷键说明

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