<div class="htmlarea"> <textarea id="runcode59928"> <script defer> function clock () { var nowtime=new Date() nowhour=nowtime.getHours() if (nowhour>=12) nowhour-=12 nowminute=nowtime.getMinutes() nowsecond=nowtime.getSeconds() nowmill=nowtime.getMilliseconds() var harc,marc,sarc,mmarc harc=(nowhour+nowminute/60+nowsecond/3600+nowmill/3600000)*30 marc=(nowminute+nowsecond/60+nowmill/60000)*6 sarc=(nowsecond+nowmill/1000)*6 //角度的字符串 nh=(180-harc)*Math.PI/180 harcT=Math.sin(nh)*250+500 harcL=Math.cos(nh)*250+500 harcStr=harcT+","+harcL document.all.hourline.to.value=harcStr //分钟的字符串 nm=(180-marc)*Math.PI/180 marcT=Math.sin(nm)*350+500 marcL=Math.cos(nm)*350+500 marcStr=marcT+","+marcL document.all.minuteline.to.value=marcStr //秒的字符串 sm=(180-sarc)*Math.PI/180 sarcT=Math.sin(sm)*400+500 sarcL=Math.cos(sm)*400+500 sarcStr=sarcT+","+sarcL document.all.secondline.to.value=sarcStr document.all.txt.innerHTML="现在时间是:"+nowtime.getHours()+":"+nowtime.getMinutes()+":"+nowtime.getSeconds() setTimeout("clock()","50") } </script> <style> v\:* { Behavior: url(#default#VML) } </style> <group id="clock" coordsize="1000,1000" style="width:200;height:200;position:relative"> <oval id="outercircle" style="width:1000;height:1000;z-index:10;" fillcolor="gray"></oval> <oval id="innercircle" style="position:relative;top:75;left:75;width:850;height:850;z-index:15" fillcolor="white"></oval> <line id="hourline" style="position:relative;z-index:20" from="500,500" to="800,800" strokecolor="gray"> <stroke startarrow="oval" endarrow="classic" dashstyle="Dot" strokecolor="red"></stroke> </line> <line id="minuteline" style="position:relative;z-index:20" from="500,500" to="500,900" strokecolor="black"> <stroke endarrow="classic" dashstyle="Dot"></stroke> </line> <line id="secondline" style="position:relative;z-index:20" from="500,500" to="400,900" strokecolor="black"> <stroke endarrow="classic" dashstyle="Dot"></stroke> </line> <span style="position:relative;top:0;left:92;z-index:25">12</span> <span style="position:relative;top:93;left:169;z-index:25">3</span> <span style="position:relative;top:185;left:67;z-index:25">6</span> <span style="position:relative;top:93;left:-40;z-index:25">9</span> <v:> <div id="txt" style="position:relative;top:220;left:40;border:1px solid black;font-size:12px;width:125;padding:3px"></div> </v:></group></textarea><br><input onclick="runEx('runcode59928')" type="button" value="运行代码"> <input onclick="doCopy('runcode59928')" type="button" value="复制代码"> <input onclick="doSave(runcode59928)" type="button" value="保存代码">[Ctrl+A 全选 注:<a href="http://www.jb51.net/article/23421.htm" title="查看具体详情" target="_blank">如需引入外部Js需刷新才能执行</a>]</div>