Discuz!官方免费开源建站系统

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

[HkDz]年齡計算器v1.0.0 For 2.5/SP1

[复制链接]
mat 发表于 2005-9-13 12:05:12 | 显示全部楼层
原帖由 hklcf 于 2005-9-13 11:43 发表

現在可以嗎?

大陸對dyndns敏感,不一定能看到..
回复

使用道具 举报

折翼の天使♂ 发表于 2005-9-13 13:46:52 | 显示全部楼层
嘻```

这个`用FLASH做``我只需几秒`钟``

不用专门弄成插件吧```嘻``

不要介意我这么说啊`!``拜托``
回复

使用道具 举报

E蓝人 发表于 2005-9-13 15:15:02 | 显示全部楼层
支持,出一个HTM版最好
回复

使用道具 举报

jimmyjimmyqqq 发表于 2005-9-13 16:02:33 | 显示全部楼层
不錯,支持一下hkdZ!
回复

使用道具 举报

 楼主| hklcf 发表于 2005-9-13 16:21:34 | 显示全部楼层
原帖由 E蓝人 于 2005-9-13 15:15 发表
支持,出一个HTM版最好

你要的東東

  1. <SCRIPT LANGUAGE="JavaScript">
  2. <!-- Begin
  3. function run() {
  4. with (document.agecalc) {
  5. dd = parseInt(day.selectedIndex) + 1;
  6. mm = parseInt(month.selectedIndex) + 1;
  7. yy = year.value;
  8. if (yy.length != 4 || isNaN(yy)) {
  9. document.agecalc.timealive.value = "請輸入四位數字的出生年份";
  10. document.agecalc.year.select();
  11. document.agecalc.year.focus();
  12. return;
  13. }
  14. }
  15. days = new Date();
  16. gdate = days.getDate();
  17. gmonth = days.getMonth();
  18. gyear = days.getYear();
  19. if (gyear < 2000) gyear += 1900;
  20. age = gyear - yy;
  21. if ((mm == (gmonth + 1)) && (dd <= parseInt(gdate))) {
  22. age = age;
  23. } else {
  24. if (mm <= (gmonth)) {
  25. age = age;
  26. } else {
  27. age = age - 1;
  28. }
  29. }
  30. if (age == 0)
  31. age = age;
  32. document.agecalc.timealive.value = "你今年 " + age+ " 歲\n";
  33. if (mm <= (gmonth + 1))
  34. age = age - 1;
  35. if ((mm == (gmonth + 1)) && (dd > parseInt(gdate)))
  36. age = age + 1;
  37. var m;
  38. var n;
  39. if (mm == 12) n = 31 - dd;
  40. if (mm == 11) n = 61 - dd;
  41. if (mm == 10) n = 92 - dd;
  42. if (mm == 9) n = 122 - dd;
  43. if (mm == 8) n = 153 - dd;
  44. if (mm == 7) n = 184 - dd;
  45. if (mm == 6) n = 214 - dd;
  46. if (mm == 5) n = 245 - dd;
  47. if (mm == 4) n = 275 - dd;
  48. if (mm == 3) n = 306 - dd;
  49. if (mm == 2) { n = 334 - dd; if (leapyear(yy)) n++; }
  50. if (mm == 1) { n = 365 - dd; if (leapyear(yy)) n++; }
  51. if (gmonth == 1) m = 31;
  52. if (gmonth == 2) {
  53. m = 59;
  54. if (leapyear(gyear)) m++;
  55. }
  56. if (gmonth == 3) { m = 90; if (leapyear(gyear)) m++; }
  57. if (gmonth == 4) { m = 120; if (leapyear(gyear)) m++; }
  58. if (gmonth == 5) { m = 151; if (leapyear(gyear)) m++; }
  59. if (gmonth == 6) { m = 181; if (leapyear(gyear)) m++; }
  60. if (gmonth == 7) { m = 212; if (leapyear(gyear)) m++; }
  61. if (gmonth == 8) { m = 243; if (leapyear(gyear)) m++; }
  62. if (gmonth == 9) { m = 273; if (leapyear(gyear)) m++; }
  63. if (gmonth == 10) { m = 304; if (leapyear(gyear)) m++; }
  64. if (gmonth == 11) { m = 334; if (leapyear(gyear)) m++; }
  65. if (gmonth == 12) { m = 365; if (leapyear(gyear)) m++; }
  66. months = age * 12;
  67. months += 12 - parseInt(mm);
  68. months += gmonth;
  69. totdays = (parseInt(age) * 365);
  70. totdays += age / 4;
  71. totdays = parseInt(totdays) + gdate + m + n;
  72. if (gmonth == 1) p = 31 + gdate;
  73. if (gmonth == 2) {
  74. p = 59 + gdate;
  75. if (leapyear(gyear)) m = m+1;
  76. }
  77. if (gmonth == 3) { p = 90 + gdate; if (leapyear(gyear)) p++; }
  78. if (gmonth == 4) { p = 120 + gdate; if (leapyear(gyear)) p++; }
  79. if (gmonth == 5) { p = 151 + gdate; if (leapyear(gyear)) p++; }
  80. if (gmonth == 6) { p = 181 + gdate; if (leapyear(gyear)) p++; }
  81. if (gmonth == 7) { p = 212 + gdate; if (leapyear(gyear)) p++; }
  82. if (gmonth == 8) { p = 243 + gdate; if (leapyear(gyear)) p++; }
  83. if (gmonth == 9) { p = 273 + gdate; if (leapyear(gyear)) p++; }
  84. if (gmonth == 10) { p = 304 + gdate; if (leapyear(gyear)) p++; }
  85. if (gmonth == 11) { p = 334 + gdate; if (leapyear(gyear)) p++; }
  86. if (gmonth == 12) { p = 365 + gdate; if (leapyear(gyear)) p++; }
  87. weeks = (age * 365) + n + p;
  88. weeks = weeks / 7;
  89. etcdays = parseFloat(weeks) - parseInt(weeks);
  90. etcdays = Math.round(etcdays * 7);
  91. weeks = parseInt(weeks);
  92. etcdays += parseInt(age / 4);
  93. if (etcdays > 7)
  94. weeks += parseInt(etcdays / 7);
  95. document.agecalc.timealive.value += "出生了" + weeks + "個星期\n";
  96. document.agecalc.timealive.value += "出生了" + months + "個月\n";
  97. document.agecalc.timealive.value += "出生了" + totdays + "天\n";
  98. var time = new Date();
  99. ghour = time.getHours();
  100. gmin = time.getMinutes();
  101. gsec = time.getSeconds();
  102. hour = ((age * 365) + n + p) * 24;
  103. hour += (parseInt(age / 4) * 24);
  104. document.agecalc.timealive.value += "出生了" + hour + "個小時\n";
  105. var min = (hour * 60) + gmin;
  106. document.agecalc.timealive.value += "出生了" + min + "分\n";
  107. sec = (min * 60) + gsec;
  108. document.agecalc.timealive.value += "出生了" + sec + "秒";
  109. mm = mm - 1;
  110. var r;
  111. if (mm == 0) r = 0;
  112. if (mm == 1) r = 31;
  113. if (mm == 2) { r = 59; if (leapyear(gyear)) m++; }
  114. if (mm == 3) { r = 90; if (leapyear(gyear)) r++; }
  115. if (mm == 4) { r = 120; if (leapyear(gyear)) r++; }
  116. if (mm == 5) { r = 151; if (leapyear(gyear)) r++; }
  117. if (mm == 6) { r = 181; if (leapyear(gyear)) r++; }
  118. if (mm == 7) { r = 212; if (leapyear(gyear)) r++; }
  119. if (mm == 8) { r = 243; if (leapyear(gyear)) r++; }
  120. if (mm == 9) { r = 273; if (leapyear(gyear)) r++; }
  121. if (mm == 10) { r = 304; if (leapyear(gyear)) r++; }
  122. if (mm == 11) { r = 334; if (leapyear(gyear)) r++; }
  123. mm = mm + 1;
  124. r = parseInt(r) + parseInt(dd);
  125. if ((mm >= (gmonth + 1)) && (dd > gdate)) {
  126. bday = r - m - gdate;
  127. }
  128. else {
  129. if ((leapyear(gyear)) && ((mm > 2) && (dd < 29))) {
  130. a = 366;
  131. } else {
  132. a = 365;
  133. }
  134. bday = a + (r - m - gdate);
  135. }
  136. nhour = 24 - parseInt(ghour);
  137. nmin = 60 - parseInt(gmin);
  138. nsec = 60 - parseInt(gsec);
  139. while (bday > 366) bday -= 365;
  140. if (((bday == 366) && (leapyear(gyear)) || ((bday == 365) && (!leapyear(gyear))))) {
  141. document.agecalc.timealive.value += "\n\n今天是你的生日!";
  142. } else {
  143. document.agecalc.timealive.value += "\n\n你離下一個生日還有:\n"
  144. + bday + " 天 " + nhour + " 小時 " + nmin + " 分 " + nsec + " 秒";
  145. setTimeout("run()", 1000);
  146. }
  147. }
  148. function leapyear(a) {
  149. if (((a%4 == 0) && (a%100 != 0)) || (a%400 == 0))
  150. return true;
  151. else
  152. return false;
  153. }
  154. // End -->
  155. </script>
  156. <form name=agecalc>
  157. <textarea rows=20 cols=130 name=timealive></textarea>
  158. 請輸入你的出生日期: <select name=month size=1>
  159. <option>一月<option>二月<option>三月<option>四月<option>五月<option>六月<option>七月<option>八月<option>九月<option>十月<option>十一月<option>十二月
  160. </select>
  161. <select name=day size=1>
  162. <option>1<option>2<option>3<option>4<option>5<option>6<option>7<option>8<option>9<option>10<option>11<option>12<option>13<option>14<option>15<option>16<option>17<option>18<option>19<option>20<option>21<option>22<option>23<option>24<option>25<option>26<option>27<option>28<option>29<option>30<option>31
  163. </select><input type=text name=year size=4 maxlength=4>
  164. <input type=button name=start value="計算" onclick="run();">
  165. </form>
  166. <SCRIPT LANGUAGE="JavaScript">
  167. <!-- hide
  168. function goHist(a)
  169. {
  170. history.go(a);
  171. }
  172. //-->
  173. </script>
复制代码
回复

使用道具 举报

jimmyjimmyqqq 发表于 2005-9-13 18:03:25 | 显示全部楼层
還不錯呀hklcf,上載系統呢?
回复

使用道具 举报

E蓝人 发表于 2005-9-13 18:04:11 | 显示全部楼层
原帖由 hklcf 于 2005-9-13 16:21 发表

你要的東東[code]
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function run() {
with (document.agecalc) {
dd = parseInt(day.selectedIndex) + 1;
mm = parseInt(month.select ...

THS.very good
回复

使用道具 举报

 楼主| hklcf 发表于 2005-9-15 16:26:35 | 显示全部楼层
原帖由 E蓝人 于 2005-9-13 18:04 发表

THS.very good

推一下
HkDz的東東不要降啊
回复

使用道具 举报

 楼主| hklcf 发表于 2005-9-18 10:47:28 | 显示全部楼层
原帖由 hklcf 于 2005-9-15 16:26 发表

推一下
HkDz的東東不要降啊

偶的post又降了推呀推
回复

使用道具 举报

 楼主| hklcf 发表于 2005-9-19 23:09:53 | 显示全部楼层
自己顶一下~~~~~~
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2024-11-21 22:04 , Processed in 0.023869 second(s), 4 queries , Gzip On, Redis On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表