📄 day2_6.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>
</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"><strong><small><small><br>
</small></small><font face="宋体" size="3">第六页:if-then子句</font></strong> <p><font
face="宋体" size="3">"if-then"子句的应用可以使得程序根据用户输入的值作出不同<br>
的反应。例如你可以写一段程序使得它对你与对其他人反应<br>
不同。这里是它的基本格式:</font></p>
<blockquote>
<pre><font face="宋体" size="3">
if (some condition is true)
{
do something;
do something;
do something;
}
</font></pre>
</blockquote>
<p><font face="宋体" size="3">本结构的重要部分:</font> <ul>
<li><font face="宋体" size="3">以单词 "<tt>if</tt>"开始 (<tt>if</tt>
必须小写). </font></li>
<li><font face="宋体" size="3">圆括弧中是条件:非真即伪。</font></li>
<li><font face="宋体" size="3">如果条件为真的话执行花括弧中的语句。</font></li>
</ul>
<p><font face="宋体" size="3">记住:空格是唯一保持程序可读性的东西。当然你可以将整<br>
个if-then语句写在一行中,但它读起来就费劲了。</font></p>
<p><font face="宋体" size="3">这里是一个<a href="day2_7.html" tppabs="http://www.pchome.net/ch/tur/pstext/teacher/javascript/day2_7.html">if-then子句的例子</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_6.html" tppabs="http://www.pchome.net/ch/tur/pstext/teacher/javascript/day2_6.html">第二天课程简介</a><br>
<font color="#FF0000">第二页</font>:<a href="day2_2.html" tppabs="http://www.pchome.net/ch/tur/pstext/teacher/javascript/day2_2.html">变量介绍</a><br>
<font color="#FF0000">第三页</font>:<a href="day2_3.html" tppabs="http://www.pchome.net/ch/tur/pstext/teacher/javascript/day2_3.html">首个变量例子的程序主体</a><br>
<font color="#FF0000">第四页</font>:<a href="day2_4.html" tppabs="http://www.pchome.net/ch/tur/pstext/teacher/javascript/day2_4.html">字符串的魔力</a><br>
<font color="#FF0000">第五页</font>:<a href="day2_5.html" tppabs="http://www.pchome.net/ch/tur/pstext/teacher/javascript/day2_5.html">变量练习</a><br>
<font color="#FF0000">第六页</font>:if-then子句<br>
<font color="#FF0000">第七页</font>:<a href="day2_7.html" tppabs="http://www.pchome.net/ch/tur/pstext/teacher/javascript/day2_7.html">if-then语句的例子</a><br>
<font color="#FF0000">第八页</font>:<a href="day2_8.html" tppabs="http://www.pchome.net/ch/tur/pstext/teacher/javascript/day2_8.html">if-then练习</a><br>
<font color="#FF0000">第九页</font>:<a href="day2_9.html" tppabs="http://www.pchome.net/ch/tur/pstext/teacher/javascript/day2_9.html">链结事件</a><br>
<font color="#FF0000">第十页</font>:<a href="day2_10.html" tppabs="http://www.pchome.net/ch/tur/pstext/teacher/javascript/day2_10.html">图片交换</a><br>
<font color="#FF0000">第十一页</font>:<a href="day2_11.html" tppabs="http://www.pchome.net/ch/tur/pstext/teacher/javascript/day2_11.html">练习2</a><br>
<font color="#FF0000">第十二页</font>:<a href="day2_12.html" tppabs="http://www.pchome.net/ch/tur/pstext/teacher/javascript/day2_12.html">复习</a></font></p>
<p align="left"><font face="宋体" size="3">[<a href="index.html" tppabs="http://www.pchome.net/ch/tur/pstext/teacher/javascript/index.html">第1课</a>][第2课][<a
href="day3_1.html" tppabs="http://www.pchome.net/ch/tur/pstext/teacher/javascript/day3_1.html">第3课</a>][<a href="day4_1.html" tppabs="http://www.pchome.net/ch/tur/pstext/teacher/javascript/day4_1.html">第4课</a>][<a href="day5_1.html" tppabs="http://www.pchome.net/ch/tur/pstext/teacher/javascript/day5_1.html">第5课</a>]</font></p>
<hr align="left">
<p><font size="2">本文由<a href="javascript:if(confirm('http://chd.126.com/ \n\nThis file was not retrieved by Teleport Pro, because it is addressed on a domain or path outside the boundaries set for its Starting Address. \n\nDo you want to open it from the server?'))window.location='http://chd.126.com/'" tppabs="http://chd.126.com/" target="_blank">《</font><font
face="verdana, arial, geneva, sans-serif" size="2">CHD</font><font size="2">的网络教室》</a>根据<a
href="javascript:if(confirm('http://www.webmonkey.com.cn/ \n\nThis file was not retrieved by Teleport Pro, because it is addressed on a domain or path outside the boundaries set for its Starting Address. \n\nDo you want to open it from the server?'))window.location='http://www.webmonkey.com.cn/'" tppabs="http://www.webmonkey.com.cn/" target="_blank">《网猴》</a>相关文章改编,版权归<a
href="javascript:if(confirm('http://www.webmonkey.com.cn/ \n\nThis file was not retrieved by Teleport Pro, because it is addressed on a domain or path outside the boundaries set for its Starting Address. \n\nDo you want to open it from the server?'))window.location='http://www.webmonkey.com.cn/'" tppabs="http://www.webmonkey.com.cn/" target="_blank">《网猴》</a>所有</font></td>
</tr>
</table>
</div>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -