我初学JavaScript,在看一个活动时钟代码,代码如下: <html> <head></head> <body onload="Time()"> <script language="JavaScript">
<!--
function Time(){ var Timer=new Date() var hours=Timer.getHours() var minutes=Timer.getMinutes() var seconds=Timer.getSeconds() var noon="AM" if (hours>12){ noon="PM" hours=hours-12 } if (hours==0) hours=12 if (minutes<=9) minutes="0"+minutes if (seconds<=9) seconds="0"+seconds //change font size here to your desire myclock="<font size='30' face='Arial' color=blue>"+hours+":"+minutes+":" +seconds+" "+noon+"</font>"
position.innerHTML=myclock setTimeout("Time()",1000) } //--> </script> <span id="position" > </span> </body></html> 我想问的是: 1、innerHTML是怎么用的,我还看到有用innertext的; 2、<body>内的<span id="position"></span>为什么这么用?它还可以用<div></div>代替,为什么; 3、我用document.write(myclock)代替position.innerHTML=myclock为什么不行? …………………………………………………………………………………………………… 我是菜鸟!!我先飞!!!