免費論壇 繁體 | 簡體
Sclub交友聊天~加入聊天室當版主
分享
返回列表 發帖

[問題] 如何移動月曆的位置?

如圖:
huhu.JPG


這個月曆的代碼出現後   都會再右邊

如何把他移動到中間



--------------------------------------------

代碼:
  1. <style>
  2. .shd {style;border:1px dashed; border-color:blue;
  3. color:white ;font:9pt Verdana;
  4. background-color:black}
  5. .shd2 { color:red ;font:9pt Verdana; }
  6. .shd3 { colorrange ;font:9pt Verdana; }
  7. .shd4 { color:green ;font:9pt Verdana; }
  8. </style>
  9. <script language="JavaScript">
  10. function greeting(){
  11. var today = new Date();
  12. var hrs = today.getHours();
  13. document.writeln("<TABLE width=220 cellSpacing=2 cellPadding=2 class=shd>");
  14. document.write("<tr><td COLSPAN=7 align=center class=shd>");
  15. if (hrs < 6)
  16. document.write("(Early) Morning");
  17. else if (hrs < 12)
  18. document.write("早安!");
  19. else if (hrs <= 18)
  20. document.write("午安!");
  21. else
  22. document.write("晚安!");
  23. document.writeln("<tr><td COLSPAN=7 align=center class=shd>");
  24. dayStr = today.toLocaleString();
  25. document.write(dayStr);
  26. document.writeln("");}
  27. function montharr(m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11){
  28. this[0] = m0;
  29. this[1] = m1;
  30. this[2] = m2;
  31. this[3] = m3;
  32. this[4] = m4;
  33. this[5] = m5;
  34. this[6] = m6;
  35. this[7] = m7;
  36. this[8] = m8;
  37. this[9] = m9;
  38. this[10] = m10;
  39. this[11] = m11;}
  40. function calendar(){
  41. var monthNames = "JanFebMarAprMayJunJulAugSepOctNovDec";
  42. var today = new Date();
  43. var thisDay;
  44. var monthDays = new montharr(31, 28, 31, 30, 31, 30, 31, 31, 30,
  45. 31, 30, 31);
  46. year = today.getYear();
  47. thisDay = today.getDate();
  48. if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0))
  49. monthDays[1] = 29;
  50. nDays = monthDays[today.getMonth()];
  51. firstDay = today;
  52. firstDay.setDate(1);
  53. testMe = firstDay.getDate();
  54. if (testMe == 2)
  55. firstDay.setDate(0);
  56. startDay = firstDay.getDay();
  57. document.write("<TR><TD class=shd><FONT class=shd3>日<TD class=shd>一<TD class=shd>二<TD class=shd>三<TD class=shd>四<TD class=shd>五<TD class=shd><FONT class=shd4>六");
  58. document.write("<TR>");
  59. column = 0;
  60. for (i=0; i<startDay; i++){
  61. document.write("<TD>");
  62. column++;}
  63. for (i=1; i<=nDays; i++){
  64. document.write("<TD class=shd>");
  65. if (i == thisDay)
  66. document.write("<FONT class=shd2>")
  67. document.write(i);
  68. if (i == thisDay)
  69. document.write("")
  70. column++;
  71. if (column == 7){
  72. document.write("<TR>");
  73. column = 0;}}
  74. document.write("</TABLE>");
  75. document.writeln("");}
  76. greeting();
  77. document.write("");
  78. calendar();
  79. document.write("");
  80. </script>
複製代碼

月历代码总感觉没必要放额。

TOP

提示: 作者被禁止或刪除 內容自動屏蔽

TOP

謝謝分享

TOP

返回列表