<script language="javascript" type="text/javascript">
function showTime() {var myTime = new Date();
var inHours = myTime.getHours();
if (inHours < 10) {inHours = "0" + inHours}
var inMinutes = myTime.getMinutes();
if (inMinutes < 10) {inMinutes = "0" + inMinutes}
var inSeconds = myTime.getSeconds();
if (inSeconds < 10) {inSeconds ="0" + inSeconds}
document.write("现在的时间是:" + inHours + ":" + inMinutes + ":" + inSeconds)}
list = setInterval(showTime,1000);
</script>
刚开始发现只能显示一次时间,就不动了,原来是因为document.write把源程序给替换了,函数不见了。list = setInterval(showTime,1000);setInterval的机制是怎么样的,难道没有记下来。
[此贴子已经被作者于2007-8-28 9:52:58编辑过]