蔚藍的天空

 找回密碼
 立即註冊

管理團隊招募中 點此管理團隊申請

《蔚藍的天空總版規》 積分計算方程式

蔚藍的天空「魔力寶貝」 蔚藍的天空「幻想神域」

蔚藍幻境 - Facebook 蔚藍的天空 - Facebook

搜索
查看: 3435|回復: 0

24時制浮動時鐘

[複製鏈接]

等級: 19- 已有大成

經驗值: 0 / 186

魔法值: 6964 / 8729

生命值: 6%

發表於 2011-8-5 11:41:21 | 顯示全部樓層 |閱讀模式
[like]
  1. <script language="JavaScript">
  2. <!--
  3. f1Col='#000000';
  4. f2Col='#7F7F7F';
  5. d1Col='#FF0000';
  6. d2Col='#FF8080';
  7. sCol='#FF00FF';
  8. mCol='#0000FF';
  9. hCol='#00BF00';
  10. ClockWidth=50;
  11. ClockHeight=50;
  12. s=7;
  13. m=9;
  14. h=11;
  15. face24='06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 01 02 03 04 05';
  16. face24=face24.split(' ');
  17. n1=face24.length;
  18. face12='15 20 25 30 35 40 45 50 55 0 5 10';
  19. face12=face12.split(' ');
  20. n2=face12.length;
  21. p="<font face=Arial size=1 color="+f1Col+">";
  22. p2="<font face=Arial size=1 color="+f2Col+">";
  23. e=360/n1;
  24. e2=360/n2
  25. e3=360/60
  26. HandHeight=ClockHeight/6;
  27. HandWidth=ClockWidth/6;
  28. y=0;
  29. x=0;
  30. ns6=(document.getElementById&&!document.all);
  31. ns=(document.layers);
  32. ie=(document.all);
  33. if (ns){
  34. for (i=0; i < n1; i++)
  35. document.write('<layer name="nshour24'+i+'" top=0 left=0 height=15 width=15><center>'+p+face24[i]+'</font></center></layer>');
  36. for (i=0; i < n1; i++)
  37. document.write('<layer name=nsdots1'+i+' top=0 left=0 bgcolor='+d1Col+' clip="0,0,2,2"></layer>');
  38. for (i=0; i < n2; i++)
  39. document.write('<layer name="nshour12'+i+'" top=0 left=0 height=15 width=15><center>'+p2+face12[i]+'</font></center></layer>');
  40. for (i=0; i < 12; i++)
  41. document.write('<layer name=nsdots2'+i+' top=0 left=0 bgcolor='+d2Col+' clip="0,0,2,2"></layer>');
  42. for (i=0; i < h; i++)
  43. document.write('<layer name=nsH'+i+' top=0 left=0 bgcolor='+hCol+' clip="0,0,2,2"></layer>');
  44. for (i=0; i < m; i++)
  45. document.write('<layer name=nsM'+i+' top=0 left=0 bgcolor='+mCol+' clip="0,0,2,2"></layer>');
  46. for (i=0; i < s; i++)
  47. document.write('<layer name=nsS'+i+' top=0 left=0 bgcolor='+sCol+' clip="0,0,2,2"></layer>');
  48. }
  49. if (ie||document.getElementById){
  50. for (i=0; i < n1; i++)
  51. document.write('<div id="hour24'+i+'" style="position:absolute;top:0px;left:0px;width:15px;height:15px;text-align:center">'+p+face24[i]+'</font></div>');
  52. for (i=0; i < n1; i++)
  53. document.write('<div id="dots1'+i+'" style="position:absolute;top:0px;left:0px;width:2px;height:2px;font-size:2px;background:'+d1Col+'"></div>');
  54. for (i=0; i < n2; i++)
  55. document.write('<div id="hour12'+i+'" style="position:absolute;top:0px;left:0px;width:15px;height:15px;text-align:center">'+p2+face12[i]+'</font></div>');
  56. for (i=0; i < 12; i++)
  57. document.write('<div id="dots2'+i+'" style="position:absolute;top:0px;left:0px;height:2px;width:2px;font-size:2px;background:'+d2Col+'"></div>');
  58. for (i=0; i < h; i++)
  59. document.write('<div id="ieH'+i+'" style="position:absolute;top:0px;left:0px;width:2px;height:2px;font-size:2px;background:'+hCol+'"></div>');
  60. for (i=0; i < m; i++)
  61. document.write('<div id="ieM'+i+'" style="position:absolute;top:0px;left:0px;width:2px;height:2px;font-size:2px;background:'+mCol+'"></div>');
  62. for (i=0; i < s; i++)
  63. document.write('<div id="ieS'+i+'" style="position:absolute;top:0px;left:0px;width:2px;height:2px;font-size:2px;background:'+sCol+'"></div>');
  64. }
  65. function Scroll(){
  66. if (ns){
  67. y=window.pageYOffset+window.innerHeight-ClockHeight*2;
  68. x=window.pageXOffset+window.innerWidth-ClockWidth*2.3;
  69. }
  70. if (ns6){
  71. y=window.pageYOffset+window.innerHeight-ClockHeight*2.1;
  72. x=window.pageXOffset+window.innerWidth-ClockWidth*2.2;
  73. }
  74. if (ie){
  75. y=document.body.scrollTop+window.document.body.clientHeight-ClockHeight*2;
  76. x=document.body.scrollLeft+window.document.body.clientWidth-ClockWidth*2;
  77. }
  78. setTimeout('Scroll()',50);
  79. }
  80. Scroll();
  81. function ClockAndAssign(){
  82. time = new Date ();
  83. secs = time.getSeconds();
  84. sec = -1.57 + Math.PI * secs/30;
  85. mins = time.getMinutes();
  86. min = -1.57 + Math.PI * mins/30;
  87. hr = time.getHours();
  88. hrs = -1.57 + Math.PI * hr/12 + Math.PI*parseInt(time.getMinutes())/720;
  89. for (i=0; i < s; i++){
  90. var cs=(ns)?document.layers['nsS'+i]:(ie)?document.all['ieS'+i].style:document.getElementById("ieS"+i).style;
  91. cs.top=y+(i*HandHeight)*Math.sin(sec);
  92. cs.left=x+(i*HandWidth)*Math.cos(sec);
  93. }
  94. for (i=0; i < m; i++){
  95. var cm=(ns)?document.layers['nsM'+i]:(ie)?document.all['ieM'+i].style:document.getElementById("ieM"+i).style;
  96. cm.top=y+(i*HandHeight)*Math.sin(min);
  97. cm.left=x+(i*HandWidth)*Math.cos(min);
  98. }
  99. for (i=0; i < h; i++){
  100. var ch=(ns)?document.layers['nsH'+i]:(ie)?document.all['ieH'+i].style:document.getElementById("ieH"+i).style;
  101. ch.top=y+(i*HandHeight)*Math.sin(hrs);
  102. ch.left=x+(i*HandWidth)*Math.cos(hrs);
  103. }
  104. for (i=0; i < 12; i++){
  105. var d2=(ns)?document.layers['nsdots2'+i]:(ie)?document.all['dots2'+i].style:document.getElementById("dots2"+i).style;
  106. d2.top=y + ClockHeight*Math.sin(-1.0471 + i*e2*Math.PI/180);
  107. d2.left=x + ClockWidth*Math.cos(-1.0471 + i*e2*Math.PI/180);
  108. }
  109. for (i=0; i < n2; i++){
  110. var h12=(ns)?document.layers['nshour12'+i]:(ie)?document.all['hour12'+i].style:document.getElementById("hour12"+i).style;
  111. h12.top=y-6 + ClockHeight*1.2*Math.sin(i*e2*Math.PI/180);
  112. h12.left=x-6 + ClockWidth*1.2*Math.cos(i*e2*Math.PI/180);
  113. }
  114. for (i=0; i < n1; i++){
  115. var d1=(ns)?document.layers['nsdots1'+i]:(ie)?document.all['dots1'+i].style:document.getElementById("dots1"+i).style;
  116. d1.top=y + ClockHeight*1.5*Math.sin(-1.0471 + i*e*Math.PI/180);
  117. d1.left=x + ClockWidth*1.5*Math.cos(-1.0471 + i*e*Math.PI/180);
  118. }
  119. for (i=0; i < n1; i++){
  120. var h24=(ns)?document.layers['nshour24'+i]:(ie)?document.all['hour24'+i].style:document.getElementById("hour24"+i).style;
  121. h24.top=y-6 + ClockHeight*1.7*Math.sin(i*e*Math.PI/180);
  122. h24.left=x-6 + ClockWidth*1.7*Math.cos(i*e*Math.PI/180);
  123. }
  124. setTimeout('ClockAndAssign()',500);
  125. }
  126. ClockAndAssign();
  127. -->
  128. </script>
複製代碼
[/like]
◎請嚴格遵守《蔚藍的天空總版規》《網頁設計版規》,以免影響自身權益!
您需要登錄後才可以回帖 登錄 | 立即註冊

本版積分規則

<
我的工具列

小黑屋|蔚藍的天空

GMT+8, 2024-4-18 16:22 , Processed in 0.049967 second(s), 18 queries .

Powered by Discuz! X3.5

Copyright © 2001-2023 Tencent Cloud.

快速回復 返回頂部 返回列表