📄 day4_11.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">第十一页:</font><font SIZE="3">函数</font></strong>
<p ALIGN="JUSTIFY"><font SIZE="3">函数是编程需学的最后一个基本组成。所有的程序语言都是<br>
函数。函数是一些角次可调用的、无须重写的东西。</font></p>
<font SIZE="3"><p ALIGN="JUSTIFY">如果你想教会自己快速阅读并且用一个一旦点击可告诉你当前<br>
时间的长文本链接。</p>
<p ALIGN="JUSTIFY">例如…<a href="#"
onClick="
var the_date = new Date();
var the_hour = the_date.getHours();
var the_minute = the_date.getMinutes();
var the_second = the_date.getSeconds();
var the_time = the_hour + ':' + the_minute + ':' + the_second;
alert('现在时间是: ' + the_time);">时间!</a></p>
<p ALIGN="JUSTIFY">看源码:</p>
</font><p ALIGN="JUSTIFY"><font face="宋体"><br>
<a href="#" onClick="<br>
<br>
var the_date = new Date();<br>
<br>
var the_hour = the_date.getHours();<br>
<br>
var the_minute = the_date.getMinutes();<br>
<br>
var the_second = the_date.getSeconds();<br>
<br>
var the_time = the_hour + ':' + the_minute + ':' + the_second;<br>
<br>
alert('The time is now: ' + the_time);">time!</a><br>
<br>
</font></p>
<p ALIGN="JUSTIFY"><font SIZE="3">在这里这段<font face="宋体">JavaScript</font>的工作细节并不重要;一会我们再回来<br>
复习一下。</font></p>
<font SIZE="3"><p ALIGN="JUSTIFY">重要的是它太长了。若这些时间链接再有<font
face="宋体">10</font>个,你须每次剪贴<br>
这段程序。这使你的<font face="宋体">HTML</font>既长且难看。另外,若你想改变这段<br>
程序,就必须在<font face="宋体">10</font>个不同地方改变。</p>
<p ALIGN="JUSTIFY">你可以写一个函数来执行而不用作<font face="宋体">10</font>次拷贝程序。这里的函数<br>
使用变的即容易编辑又容易阅读。</p>
<p ALIGN="JUSTIFY">请看如何写一段<a href="day4_12.html" tppabs="http://www.pchome.net/ch/tur/pstext/teacher/javascript/day4_12.html">计时函数</a>。</p>
</font><p align="left"><font face="宋体" size="3" color="#000000"><strong>JavaScript教程</strong></font><font
color="#FF0000" face="宋体" size="3"><br>
</font><font size="3" color="#FF0000">第一页</font><font size="2" face="宋体"> </font><a
href="day4_11.html" tppabs="http://www.pchome.net/ch/tur/pstext/teacher/javascript/day4_11.html"><font SIZE="3">第四课介绍</font></a><font size="2"><br>
</font><font SIZE="3"><font color="#FF0000">第二页</font> <a href="day4_2.html" tppabs="http://www.pchome.net/ch/tur/pstext/teacher/javascript/day4_2.html">循环介绍</a></font><font
size="2"><br>
</font><font SIZE="3"><font color="#FF0000">第三页</font> <a href="day4_3.html" tppabs="http://www.pchome.net/ch/tur/pstext/teacher/javascript/day4_3.html">循环的密码</a></font><font
size="2"><br>
</font><font SIZE="3"><font color="#FF0000">第四页</font> <a href="day4_4.html" tppabs="http://www.pchome.net/ch/tur/pstext/teacher/javascript/day4_4.html">再谈<font
face="宋体">WHILE</font>循环</a></font><font size="2"><br>
</font><font SIZE="3"><font color="#FF0000">第五页</font> <a href="day4_5.html" tppabs="http://www.pchome.net/ch/tur/pstext/teacher/javascript/day4_5.html">For循环</a></font><font
size="2"><br>
</font><font SIZE="3"><font color="#FF0000">第六页</font> <a href="day4_6.html" tppabs="http://www.pchome.net/ch/tur/pstext/teacher/javascript/day4_6.html">嵌套循环</a></font><font
size="2"><br>
</font><font SIZE="3"><font color="#FF0000">第七页</font> <a href="day4_7.html" tppabs="http://www.pchome.net/ch/tur/pstext/teacher/javascript/day4_7.html">循环练习</a></font><font
size="2"><br>
</font><font SIZE="3"><font color="#FF0000">第八页</font> <a href="day4_8.html" tppabs="http://www.pchome.net/ch/tur/pstext/teacher/javascript/day4_8.html">数组</a></font><font
size="2"><br>
</font><font SIZE="3"><font color="#FF0000">第九页</font> <a href="day4_9.html" tppabs="http://www.pchome.net/ch/tur/pstext/teacher/javascript/day4_9.html">数组和循环</a></font><font
size="2"><br>
</font><font SIZE="3"><font color="#FF0000">第十页</font> <a href="day4_10.html" tppabs="http://www.pchome.net/ch/tur/pstext/teacher/javascript/day4_10.html">文件目标模块中的数组</a></font><font
size="2"><br>
</font><font SIZE="3"><font color="#FF0000">第十一页</font> 函数</font><font
size="2"><br>
</font><font SIZE="3"><font color="#FF0000">第十二页</font> <a href="day4_12.html" tppabs="http://www.pchome.net/ch/tur/pstext/teacher/javascript/day4_12.html">无参数函数</a></font><font
size="2"><br>
</font><font SIZE="3"><font color="#FF0000">第十三页</font> <a href="day4_13.html" tppabs="http://www.pchome.net/ch/tur/pstext/teacher/javascript/day4_13.html">参数及返回值</a></font><font
size="2"><br>
</font><font SIZE="3"><font color="#FF0000">第十四页</font> <a href="day4_14.html" tppabs="http://www.pchome.net/ch/tur/pstext/teacher/javascript/day4_14.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>][<a
href="day2_1.html" tppabs="http://www.pchome.net/ch/tur/pstext/teacher/javascript/day2_1.html">第2课</a>][<a href="day3_1.html" tppabs="http://www.pchome.net/ch/tur/pstext/teacher/javascript/day3_1.html">第3课</a>][第4课][<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 + -