足球游戏_中国足彩网¥体育资讯$

随鼠标移动的时钟非常漂亮遗憾的是只支持IE
来源:易贤网 阅读:1149 次 日期:2014-08-14 15:45:10
温馨提示:易贤网小编为您整理了“随鼠标移动的时钟非常漂亮遗憾的是只支持IE”,方便广大网友查阅!

新建一个文本文件,将下面的代码复制进去,将文件名字改为clock.html运行即可。

view sourceprint?001 <SCRIPT language=JavaScript><!--

002 dCol='0000FF';//date colour.

003 fCol='0000FF';//face colour.

004 sCol='0000FF';//seconds colour.

005 mCol='0000FF';//minutes colour.

006 hCol='0000FF';//hours colour.

007 ClockHeight=40;

008 ClockWidth=40;

009 ClockFromMouseY=0;

010 ClockFromMouseX=100;

011 //Alter nothing below! Alignments will be lost!

012 d=new Array("SUNDAY","MONDAY","TUESDAY","WEDNESDAY","THURSDAY","FRIDAY","SATURDAY");

013 m=new Array("JANUARY","FEBRUARY","MARCH","APRIL","MAY","JUNE","JULY","AUGUST","SEPTEMBER","OCTOBER","NOVEMBER","DECEMBER");

014 date=new Date();

015 day=date.getDate();

016 year=date.getYear();

017 if (year < 2000) year=year+1900;

018 TodaysDate=" "+d[date.getDay()]+" "+day+" "+m[date.getMonth()]+" "+year;

019 D=TodaysDate.split('');

020 H='...';

021 H=H.split('');

022 M='....';

023 M=M.split('');

024 S='.....';

025 S=S.split('');

026 Face='1 2 3 4 5 6 7 8 9 10 11 12';

027 font='Arial';

028 size=1;

029 speed=0.5;

030 ns=(document.layers);

031 ie=(document.all);

032 Face=Face.split(' ');

033 n=Face.length;

034 a=size*10;

035 ymouse=0;

036 xmouse=0;

037 scrll=0;

038 props="<font face="+font+" size="+size+" color="+fCol+"><B>";

039 props2="<font face="+font+" size="+size+" color="+dCol+"><B>";

040 Split=360/n;

041 Dsplit=360/D.length;

042 HandHeight=ClockHeight/4.5

043 HandWidth=ClockWidth/4.5

044 HandY=-7;

045 HandX=-2.5;

046 scrll=0;

047 step=0.06;

048 currStep=0;

049 y=new Array();x=new Array();Y=new Array();X=new Array();

050 for (i=0; i < n; i++){y[i]=0;x[i]=0;Y[i]=0;X[i]=0}

051 Dy=new Array();Dx=new Array();DY=new Array();DX=new Array();

052 for (i=0; i < D.length; i++){Dy[i]=0;Dx[i]=0;DY[i]=0;DX[i]=0}

053 if (ns){

054 for (i=0; i < D.length; i++)

055 document.write('<layer name="nsDate'+i+'" top=0 left=0 height='+a+' width='+a+'><center>'+props2+D[i]+'</font></center></layer>');

056 for (i=0; i < n; i++)

057 document.write('<layer name="nsFace'+i+'" top=0 left=0 height='+a+' width='+a+'><center>'+props+Face[i]+'</font></center></layer>');

058 for (i=0; i < S.length; i++)

059 document.write('<layer name=nsSeconds'+i+' top=0 left=0 width=15 height=15><font face=Arial size=3 color='+sCol+'><center><b>'+S[i]+'</b></center></font></layer>');

060 for (i=0; i < M.length; i++)

061 document.write('<layer name=nsMinutes'+i+' top=0 left=0 width=15 height=15><font face=Arial size=3 color='+mCol+'><center><b>'+M[i]+'</b></center></font></layer>');

062 for (i=0; i < H.length; i++)

063 document.write('<layer name=nsHours'+i+' top=0 left=0 width=15 height=15><font face=Arial size=3 color='+hCol+'><center><b>'+H[i]+'</b></center></font></layer>');

064 }

065 if (ie){

066 document.write('<div id="Od" style="position:absolute;top:0px;left:0px"><div style="position:relative">');

067 for (i=0; i < D.length; i++)

068 document.write('<div id="ieDate" style="position:absolute;top:0px;left:0;height:'+a+';width:'+a+';text-align:center">'+props2+D[i]+'</B></font></div>');

069 document.write('</div></div>');

070 document.write('<div id="Of" style="position:absolute;top:0px;left:0px"><div style="position:relative">');

071 for (i=0; i < n; i++)

072 document.write('<div id="ieFace" style="position:absolute;top:0px;left:0;height:'+a+';width:'+a+';text-align:center">'+props+Face[i]+'</B></font></div>');

073 document.write('</div></div>');

074 document.write('<div id="Oh" style="position:absolute;top:0px;left:0px"><div style="position:relative">');

075 for (i=0; i < H.length; i++)

076 document.write('<div id="ieHours" style="position:absolute;width:16px;height:16px;font-family:Arial;font-size:16px;color:'+hCol+';text-align:center;font-weight:bold">'+H[i]+'</div>');

077 document.write('</div></div>');

078 document.write('<div id="Om" style="position:absolute;top:0px;left:0px"><div style="position:relative">');

079 for (i=0; i < M.length; i++)

080 document.write('<div id="ieMinutes" style="position:absolute;width:16px;height:16px;font-family:Arial;font-size:16px;color:'+mCol+';text-align:center;font-weight:bold">'+M[i]+'</div>');

081 document.write('</div></div>')

082 document.write('<div id="Os" style="position:absolute;top:0px;left:0px"><div style="position:relative">');

083 for (i=0; i < S.length; i++)

084 document.write('<div id="ieSeconds" style="position:absolute;width:16px;height:16px;font-family:Arial;font-size:16px;color:'+sCol+';text-align:center;font-weight:bold">'+S[i]+'</div>');

085 document.write('</div></div>')

086 }

087 (ns)?window.captureEvents(Event.MOUSEMOVE):0;

088 function Mouse(evnt){

089 ymouse = (ns)?evnt.pageY+ClockFromMouseY-(window.pageYOffset):event.y+ClockFromMouseY;

090 xmouse = (ns)?evnt.pageX+ClockFromMouseX:event.x+ClockFromMouseX;

091 }

092 (ns)?window.onMouseMove=Mouse:document.onmousemove=Mouse;

093 function ClockAndAssign(){

094 time = new Date ();

095 secs = time.getSeconds();

096 sec = -1.57 + Math.PI * secs/30;

097 mins = time.getMinutes();

098 min = -1.57 + Math.PI * mins/30;

099 hr = time.getHours();

100 hrs = -1.575 + Math.PI * hr/6+Math.PI*parseInt(time.getMinutes())/360;

101 if (ie){

102 Od.style.top=window.document.body.scrollTop;

103 Of.style.top=window.document.body.scrollTop;

104 Oh.style.top=window.document.body.scrollTop;

105 Om.style.top=window.document.body.scrollTop;

106 Os.style.top=window.document.body.scrollTop;

107 }

108 for (i=0; i < n; i++){

109 var F=(ns)?document.layers['nsFace'+i]:ieFace[i].style;

110 F.top=y[i] + ClockHeight*Math.sin(-1.0471 + i*Split*Math.PI/180)+scrll;

111 F.left=x[i] + ClockWidth*Math.cos(-1.0471 + i*Split*Math.PI/180);

112 }

113 for (i=0; i < H.length; i++){

114 var HL=(ns)?document.layers['nsHours'+i]:ieHours[i].style;

115 HL.top=y[i]+HandY+(i*HandHeight)*Math.sin(hrs)+scrll;

116 HL.left=x[i]+HandX+(i*HandWidth)*Math.cos(hrs);

117 }

118 for (i=0; i < M.length; i++){

119 var ML=(ns)?document.layers['nsMinutes'+i]:ieMinutes[i].style;

120 ML.top=y[i]+HandY+(i*HandHeight)*Math.sin(min)+scrll;

121 ML.left=x[i]+HandX+(i*HandWidth)*Math.cos(min);

122 }

123 for (i=0; i < S.length; i++){

124 var SL=(ns)?document.layers['nsSeconds'+i]:ieSeconds[i].style;

125 SL.top=y[i]+HandY+(i*HandHeight)*Math.sin(sec)+scrll;

126 SL.left=x[i]+HandX+(i*HandWidth)*Math.cos(sec);

127 }

128 for (i=0; i < D.length; i++){

129 var DL=(ns)?document.layers['nsDate'+i]:ieDate[i].style;

130 DL.top=Dy[i] + ClockHeight*1.5*Math.sin(currStep+i*Dsplit*Math.PI/180)+scrll;

131 DL.left=Dx[i] + ClockWidth*1.5*Math.cos(currStep+i*Dsplit*Math.PI/180);

132 }

133 currStep-=step;

134 }

135 function Delay(){

136 scrll=(ns)?window.pageYOffset:0;

137 Dy[0]=Math.round(DY[0]+=((ymouse)-DY[0])*speed);

138 Dx[0]=Math.round(DX[0]+=((xmouse)-DX[0])*speed);

139 for (i=1; i < D.length; i++){

140 Dy[i]=Math.round(DY[i]+=(Dy[i-1]-DY[i])*speed);

141 Dx[i]=Math.round(DX[i]+=(Dx[i-1]-DX[i])*speed);

142 }

143 y[0]=Math.round(Y[0]+=((ymouse)-Y[0])*speed);

144 x[0]=Math.round(X[0]+=((xmouse)-X[0])*speed);

145 for (i=1; i < n; i++){

146 y[i]=Math.round(Y[i]+=(y[i-1]-Y[i])*speed);

147 x[i]=Math.round(X[i]+=(x[i-1]-X[i])*speed);

148 }

149 ClockAndAssign();

150 setTimeout('Delay()',40);

151 }

152 if (ns||ie)window.onload=Delay;

153 // --></SCRIPT>

中国足彩网信息请查看IT技术专栏

中国足彩网信息请查看网络编程
由于各方面情况的不断调整与变化,易贤网提供的所有考试信息和咨询回复仅供参考,敬请考生以权威部门公布的正式信息和咨询为准!

2025国考·省考课程试听报名

  • 报班类型
  • 姓名
  • 手机号
  • 验证码
关于我们 | 联系我们 | 人才招聘 | 网站声明 | 网站帮助 | 非正式的简要咨询 | 简要咨询须知 | 加入群交流 | 手机站点 | 投诉建议
工业和信息化部备案号:滇ICP备2023014141号-1 足球游戏_中国足彩网¥体育资讯$ 滇公网安备53010202001879号 人力资源服务许可证:(云)人服证字(2023)第0102001523号
云南网警备案专用图标
联系电话:0871-65099533/13759567129 获取招聘考试信息及咨询关注公众号:hfpxwx
咨询QQ:526150442(9:00—18:00)版权所有:易贤网
云南网警报警专用图标