(二).代码
<html>
<head>
<title>window.setTimeout()函数</title>
<script laguage="javascript">
<!--
function showtime()
{
mytime=new Date();
mytime=mytime.getHours()+":"+mytime.getMinutes()+":"+mytime.getSeconds();
document.myform.mytext.value=mytime;
window.clearTimeout(mytimeout);
var mytimeout=window.setTimeout("showtime()",1000)
}
//-->
</script>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<form name="myform">
<table border=0 align=center>
<tr>
<td><input type=text name=mytext size=20 style="background-color:lightgreen;color:blue"></td>
<td><input type=button value="设置时间" οnclick=window.setTimeout("showtime()",1000) style="background-color:lightblue;"></td>
</tr>
</table>
</form>
</body>
</html>