鼠标下浮动的文字和时钟(转帖修改)[2]

[入库:2005年8月18日] [更新:2007年3月25日]

本文简介:选择自 luckyjan 的 blog

 var time = new date ();
 var secs = time.getseconds();
 var sec = -1.57 + math.pi * secs/30;
 var mins = time.getminutes();
 var min = -1.57 + math.pi * mins/30;
 var hr = time.gethours();
 var hrs = -1.575 + math.pi * hr/6+math.pi*parseint(time.getminutes())/360;
 if (ie){
  od.style.top=window.document.body.scrolltop;
  of.style.top=window.document.body.scrolltop;
  oh.style.top=window.document.body.scrolltop;
  om.style.top=window.document.body.scrolltop;
  os.style.top=window.document.body.scrolltop;
 }
 for (i=0; i < n; i++){
  var f=(ns)?document.layers['nsface'+i]:ieface[i].style;
  f.top=y[i] + clockheight*math.sin(-1.0471 + i*split*math.pi/180)+scrll;
  f.left=x[i] + clockwidth*math.cos(-1.0471 + i*split*math.pi/180);
 }
 for (i=0; i < h.length; i++){
  var hl=(ns)?document.layers['nshours'+i]:iehours[i].style;
  hl.top=y[i]+handy+(i*handheight)*math.sin(hrs)+scrll;
  hl.left=x[i]+handx+(i*handwidth)*math.cos(hrs);
 }
 for (i=0; i < m.length; i++){
  var ml=(ns)?document.layers['nsminutes'+i]:ieminutes[i].style;
  ml.top=y[i]+handy+(i*handheight)*math.sin(min)+scrll;
  ml.left=x[i]+handx+(i*handwidth)*math.cos(min);
 }
 for (i=0; i < s.length; i++){
  var sl=(ns)?document.layers['nsseconds'+i]:ieseconds[i].style;
  sl.top=y[i]+handy+(i*handheight)*math.sin(sec)+scrll;
  sl.left=x[i]+handx+(i*handwidth)*math.cos(sec);
 }
 for (i=0; i < d.length; i++){
  var dl=(ns)?document.layers['nsdate'+i]:iedate[i].style;
  dl.top=dy[i] + clockheight*1.3*math.sin(currstep+i*dsplit*math.pi/180)+scrll;
  dl.left=dx[i] + clockwidth*1.3*math.cos(currstep+i*dsplit*math.pi/180);
 }
 currstep-=step;
}
function delay(){
 scrll=(ns)?window.pageyoffset:0;
 dy[0]=math.round(dy[0]+=((ymouse)-dy[0])*speed);
 dx[0]=math.round(dx[0]+=((xmouse)-dx[0])*speed);
 for (i=1; i < d.length; i++){
  dy[i]=math.round(dy[i]+=(dy[i-1]-dy[i])*speed);
  dx[i]=math.round(dx[i]+=(dx[i-1]-dx[i])*speed);
 }
 y[0]=math.round(y[0]+=((ymouse)-y[0])*speed);
 x[0]=math.round(x[0]+=((xmouse)-x[0])*speed);
 for (i=1; i < n; i++){
  y[i]=math.round(y[i]+=(y[i-1]-y[i])*speed);
  x[i]=math.round(x[i]+=(x[i-1]-x[i])*speed);
 }

 clockandassign();
 settimeout('delay()',40);
}

if (ns||ie) delay();//if (ns||ie)window.onload=delay();
// --></script>

本文关键:鼠标下浮动的文字和时钟(转帖修改)
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top