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

📄 day1_3.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><!--figure out which page content to display --><script language="JavaScript"><!-- hide mefunction doAlert() {	var password = "open sesame";	var answer = prompt("what's the password? ","");	alert((answer == password) ? "welcome!" : "buzz off");}// hide 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="458" valign="top" align="left" rowspan="2"><small><small><br>        </small></small><strong>第三页:<font face="宋体" size="3">一个if-then-else的快捷方式</font></strong>        <p><font face="宋体">在JavaScript中最常用得语句就是if-then-else。下面是一<br>          个奖励猴子的例子:</font>        <ul>          <pre><font face="宋体">if (monkey_behavior == &quot;good&quot;){	var toy = &quot;videogames&quot;;} else {	var toy = &quot;rocks&quot;;}</font></pre>        </ul>        <p><font face="宋体">用通俗的英语翻译上面的代码意思是说:“如果猴子表现得<br>          好,就允许他玩电子游戏,否则就扁它。”上面的例子显示<br>          了if-then-else语句的标准格式,但是对于那些喜欢投机取<br>          巧的人,还有一种快捷方式:</font>        <ul>          <pre><font face="宋体">var toy = (monkey_behavior==&quot;good&quot;) ? &quot;videogames&quot; : &quot;rocks&quot;;</font></pre>        </ul>        <p><font face="宋体">这个表达式和上面对语句所起的作用是完全一样的。这个条<br>          件语句有3部分:测试条件,测试为真时返回的值,以及测试<br>          为假时返回答值。在上面对例子中,测试条件是<br>          <tt>(monkey_behavior==&quot;good&quot;)</tt>。如果测试条件为真,则返回字<br>          符串videogames;如果测试条件为假,则返回分号右边的值:<br>          rock。 </font></p>        <p><font face="宋体">这种快捷方式在函数调用中使用时非常便利。例如,你可以用<br>          它来做下面的事情:</font></p>        <p><font face="宋体">var password = &quot;open sesame&quot;;<br>          <br>          var answer = prompt(&quot;what's the password? &quot;,&quot;&quot;);<br>          <br>          alert((answer == password) ? &quot;welcome!&quot; : &quot;buzz off&quot;);<br>          <br>          <a href="#" onClick="doAlert(); return false;">点击这里</a>你就可以看到代码执行的过程。根据你所输入的字符<br>          是否是规定单密码,你将受到“欢迎”的信息或者to是蜂鸣。 </font></p>        <p><font face="宋体">如果没有这种条件语句,则必须这样书写代码:: </font></p>        <blockquote>           <pre><font face="宋体">var password = &quot;open sesame&quot;;var answer = prompt(&quot;what's the password? &quot;,&quot;&quot;);if (answer == password) {	alert(&quot;welcome&quot;);} else {	alert(&quot;buzz off&quot;);}	</font></pre>        </blockquote>        <p><font face="宋体">显然代码长了很多,但是也更容易了解它的含义。选用何种<br>          条件语句依每个人的喜好而定。<a href="day1_4.html">&gt;&gt;</a></font></p>        <p><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="day1_3.html">Javascript高级教程</a><br>          <font color="#FF0000">第二页</font> <a href="day1_2.html">本教程的课程计划</a><br>          <font color="#FF0000">第三页</font> 一个if-then-else的快捷方式<br>          <font color="#FF0000">第四页</font> <a href="day1_4.html">什么是变量</a><br>          <font color="#FF0000">第五页</font> <a href="day1_5.html">变量的使用方法</a></font><font size="2" face="宋体"><br>          </font></p>        <p><font size="3">[第1课][<a href="day2_1.html">第2课</a>][<a href="day3_1.html">第3课</a>][<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 + -