目前分類:網頁語法特效~日期時間 (50)

瀏覽方式: 標題列表 簡短摘要

語法展示::  http://home.graffiti.net/hhtgvfgrrd/


請用IE6.0或更新版本觀看語法特效展示


將以下程式碼複製,貼在<head>及</head>標籤之間。

<script language="JavaScript">
<!--
function runClock() {
theTime = window.setTimeout("runClock()", 1000);
var today = new Date();
var display= today.toLocaleString();
status=display;
}
-->
</script>


將以下程式碼複製,貼在<body >標籤裡面。

 onLoad="runClock()"

uuiop6623 發表在 痞客邦 PIXNET 留言(0) 人氣()

語法展示::  http://home.graffiti.net/ujhygt55/


請用IE6.0或更新版本觀看語法特效展示

將以下程式碼複製,貼在<body>及</body>標籤之間。

<script language="JavaScript">
<!--
    var Temp;
    var TimerId = null;
    var TimerRunning = false;
    Seconds = 0
    Minutes = 0
    Hours = 0
    function showtime()
    {
      if(Seconds >= 59)
      {
        Seconds = 0
        if(Minutes >= 59)
        {
          Minutes = 0
          if(Hours >= 23)
          {
            Seconds = 0
            Minutes = 0
            Hours = 0
          }
          else {
            ++Hours
          }
        }
        else {
          ++Minutes
        }
      }
      else {
        ++Seconds
      }
      if(Seconds != 1) { var ss="s" } else { var ss="" }
      if(Minutes != 1) { var ms="s" } else { var ms="" }
      if(Hours != 1) { var hs="s" } else { var hs="" }
      Temp = '停留時間: '+Hours+' 小時'+' '+Minutes+' 分'+' '+Seconds+' 秒'+''
      window.status = Temp;
      TimerId = setTimeout("showtime()", 1000);
      TimerRunning = true;
    }
    var TimerId = null;
    var TimerRunning = false;
    function stopClock() {
      if(TimerRunning)
        clearTimeout(TimerId);
        TimerRunning = false;
    }
    function startClock() {
      stopClock();
      showtime();
    }
    function stat(txt) {
      window.status = txt;
      setTimeout("erase()", 2000);
    }
    function erase() {
      window.status = "";
    }
-->
</script>


將以下程式碼複製,貼在插入<body >標籤裡面。

 onLoad="startClock()"

uuiop6623 發表在 痞客邦 PIXNET 留言(0) 人氣()

語法展示::   http://home.graffiti.net/klgfdgdffg/


請用IE6.0或更新版本觀看語法特效展示

將以下程式碼複製,貼在<body>及</body>標籤之間。

<script language="JavaScript">
<!--
var clocktext, timeday;
var pagetitle = document.title;
function scroll() {
today = new Date();
sec = today.getSeconds();
hr = today.getHours();
min = today.getMinutes();
if (hr < 12) { timeday = " AM"; }
else { timeday = " PM"; }
if (hr > 12) hr = hr - 12;
if (hr <= 9) hr = "0" + hr;
if (min <= 9) min = "0" + min;
if (sec <= 9) sec = "0" + sec;
var clocktext = ":" + hr + ":" + min + ":" + sec + timeday;
clocktimer = setTimeout("scroll()", 1000);
document.title = pagetitle + clocktext;
}
if (document.all) scroll();
-->
</script>

uuiop6623 發表在 痞客邦 PIXNET 留言(0) 人氣()

語法展示::  http://home.graffiti.net/fjfghfghfx/


請用IE6.0或更新版本觀看語法特效展示

將以下程式碼複製,貼在<body>及</body>標籤之間。

<script language="JavaScript1.2">
<!--
var isnMonth = new
Array("1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月");
var isnDay = new
Array("星期日","星期一","星期二","星期三","星期四","星期五","星期六","星期日");
today = new Date () ;
Year=today.getYear();
Date=today.getDate();
if (document.all)
document.title="今天是: "+Year+"年"+isnMonth[today.getMonth()]+Date+"日"+isnDay[today.getDay()]
-->
</script>

uuiop6623 發表在 痞客邦 PIXNET 留言(0) 人氣()

語法展示::  http://home.graffiti.net/ghjkfghgf/


請用IE6.0或更新版本觀看語法特效展示

將以下程式碼複製,貼在<body>及</body>標籤之間。


<script language="JavaScript">
<!--
function GetTime() {
var dt = new Date();
var def = dt.getTimezoneOffset()/60;
var gmt = (dt.getHours() + def);
document.clock.local.value = (IfZero(dt.getHours()) + ":" + IfZero(dt.getMinutes()) + ":" + IfZero(dt.getSeconds()));
var ending = ":" + IfZero(dt.getMinutes()) + ":" + IfZero(dt.getSeconds());
var rome =check24(((gmt + 1) > 24) ? ((gmt + 1) - 24) : (gmt + 1));
document.clock.rome.value = (IfZero(rome) + ending);
var isr =check24(((gmt + 2) > 24) ? ((gmt + 2) - 24) : (gmt + 2));
document.clock.Israel.value = (IfZero(isr) + ending);
var msw =check24(((gmt + 3) > 24) ? ((gmt + 3) - 24) : (gmt + 3));
document.clock.msw.value = (IfZero(msw) + ending);
var baku =check24(((gmt + 4) > 24) ? ((gmt + 4) - 24) : (gmt + 4));
document.clock.baku.value = (IfZero(baku) + ending);
var del =check24(((gmt + 5) > 24) ? ((gmt + 5) - 24) : (gmt + 5));
document.clock.del.value = (IfZero(del) + ending);
var dh =check24(((gmt + 6) > 24) ? ((gmt + 6) - 24) : (gmt + 6));
document.clock.dh.value = (IfZero(dh) + ending);
var kok =check24(((gmt +7 ) > 24) ? ((gmt +7 ) - 24) : (gmt + 7));
document.clock.kok.value = (IfZero(kok) + ending);
var ho =check24(((gmt + 8) > 24) ? ((gmt + 8) - 24) : (gmt + 8));
document.clock.ho.value = (IfZero(ho) + ending);
var tky =check24(((gmt + 9) > 24) ? ((gmt + 9) - 24) : (gmt + 9));
document.clock.tky.value = (IfZero(tky) + ending);
var sdn =check24(((gmt + 10) > 24) ? ((gmt + 10) - 24) : (gmt + 10));
document.clock.sdn.value = (IfZero(sdn) + ending);
var mag =check24(((gmt + 11) > 24) ? ((gmt + 11) - 24) : (gmt + 11));
document.clock.mag.value = (IfZero(mag) + ending);
var wll =check24(((gmt + 12) > 24) ? ((gmt + 12) - 24) : (gmt + 12));
document.clock.wll.value = (IfZero(wll) + ending);
var _GMT =check24(((gmt) > 24) ? ((gmt) - 24) : (gmt));
document.clock._GMT.value = (IfZero(_GMT) + ":" + IfZero(dt.getMinutes()) + ":" + IfZero(dt.getSeconds()));
var eniw =check24(((gmt + (24-12)) > 24) ? ((gmt + (24-12)) - 24) : (gmt + (24-12)));
document.clock.eniw.value = (IfZero(eniw) + ending);
var sam =check24(((gmt + (24-11)) > 24) ? ((gmt + (24-11)) - 24) : (gmt + (24-11)));
document.clock.sam.value = (IfZero(sam) + ending);
var haw =check24(((gmt + (24-10)) > 24) ? ((gmt + (24-10)) - 24) : (gmt + (24-10)));
document.clock.Hawaii.value = (IfZero(haw) + ending);
var ala =check24(((gmt + (24-9)) > 24) ? ((gmt + (24-9)) - 24) : (gmt + (24-9)));
document.clock.alaska.value = (IfZero(ala) + ending);
var pacif =check24(((gmt + (24-8)) >= 24) ? ((gmt + (24-8)) - 24) : (gmt + (24-8)));
document.clock.pacif.value = (IfZero(pacif) + ending);
var mount =check24(((gmt + (24-7)) > 24) ? ((gmt + (24-7)) - 24) : (gmt + (24-7)));
document.clock.mount.value = (IfZero(mount) + ending);
var center =check24(((gmt + (24-6)) > 24) ? ((gmt + (24-6)) - 24) : (gmt + (24-6)));
document.clock.center.value = (IfZero(center) + ending);
var east =check24(((gmt + (24-5)) > 24) ? ((gmt + (24-5)) - 24) : (gmt + (24-5)));
document.clock.east.value = (IfZero(east) + ending);
var atl =check24(((gmt + (24-4)) > 24) ? ((gmt + (24-4)) - 24) : (gmt + (24-4)));
document.clock.atl.value = (IfZero(atl) + ending);
var bra =check24(((gmt + (24-3)) > 24) ? ((gmt + (24-3)) - 24) : (gmt + (24-3)));
bra = (bra >= 24) ? bra - 24 : bra;
document.clock.bra.value = (IfZero(bra) + ending);
var mid =check24(((gmt + (24-2)) > 24) ? ((gmt + (24-2)) - 24) : (gmt + (24-2)));
mid = (mid >= 24) ? mid - 24 : mid;
document.clock.mid.value = (IfZero(mid) + ending);
var azo =check24(((gmt + (24-1)) > 24) ? ((gmt + (24-1)) - 24) : (gmt + (24-1)));
azo = (azo >= 24) ? azo - 24 : azo;
document.clock.azo.value = (IfZero(azo) + ending);
setTimeout("GetTime()", 1000);
}
function IfZero(num) {
return ((num <= 9) ? ("0" + num) : num);
}
function check24(hour) {
return (hour >= 24) ? hour - 24 : hour;
}
-->
</script>
<center>
<form name="clock">
    <table border="1" cellspacing="0" cellpadding="5">
      <tr>
        <td colspan="5"><center>各地時間</center></td>
      </tr>
      <tr>
        <td><center>Eniwetok<br>(-12)</center></td>
        <td><input type="text" size="7" name="eniw"></td>
        <td rowspan="12"><center>格林威治<br>標準時間<br><input type="text" size="7" name="_GMT"></center></td>
        <td><center>威靈頓<br>(+12)</center></td>
        <td><input type="text" size="7" name="wll"></td>
      </tr>
      <tr>
        <td><center>薩摩亞<br>(-11)</center></td>
        <td><input type="text" size="7" name="sam"></td>
        <td><center>Magadan<br>(+11)</center></td>
        <td><input type="text" size="7" name="mag"></td>
      </tr>
      <tr>
        <td><center>夏威夷<br>(-10)</center></td>
        <td><input type="text" size="7" name="Hawaii"></td>
        <td><center>雪梨<br>(+10)</center></td>
        <td><input type="text" size="7" name="sdn"></td>
      </tr>
      <tr>
        <td><center>阿拉斯加<br>(-9)</center></td>
        <td><input type="text" size="7" name="alaska"></td>
        <td><center>東京<br>(+9)</center></td>
        <td><input type="text" size="7" name="tky"></td>
      </tr>
      <tr>
        <td><center>太平洋 Time<br>(-8)</center></td>
        <td><input type="text" size="7" name="pacif"></td>
        <td><center>香港<br>(+8)</center></td>
        <td><input type="text" size="7" name="ho"></td>
      </tr>
      <tr>
        <td><center>Mountain Time<br>(-7)</center></td>
        <td><input type="text" size="7" name="mount"></td>
        <td><center>曼谷<br>(+7)</center></td>
        <td><input type="text" size="7" name="kok"></td>
      </tr>
      <tr>
        <td><center>Central Time<br>(-6)</center></td>
        <td><input type="text" size="7" name="center"></td>
        <td><center>Dhakar<br>(+6)</center></td>
        <td><input type="text" size="7" name="dh"></td>
      </tr>
      <tr>
        <td><center>東方 Time<br>(-5)</center></td>
        <td><input type="text" size="7" name="east"></td>
        <td><center>New Delhi<br>(+5)</center></td>
        <td><input type="text" size="7" name="del"></td>
      </tr>
      <tr>
        <td><center>大西洋 Time<br>(-4)</center></td>
        <td><input type="text" size="7" name="atl"></td>
        <td><center>Baku<br>(+4)</center></td>
        <td><input type="text" size="7" name="baku"></td>
      </tr>
      <tr>
        <td><center>Brazilia<br>(-3)</center></td>
        <td><input type="text" size="7" name="bra"></td>
        <td><center>莫斯科<br>(+3)</center></td>
        <td><input type="text" size="7" name="msw"></td>
      </tr>
      <tr>
        <td><center>Mid-Atlantic<br>(-2)</center></td>
        <td><input type="text" size="7" name="mid"></td>
        <td><center>以色列<br>(+2)</center></td>
        <td><input type="text" size="7" name="Israel"></td>
      </tr>
      <tr>
        <td><center>Azores<br>(-1)</center></td>
        <td><input type="text" size="7" name="azo"></td>
        <td><center>羅馬<br>(+1)</center></td>
        <td><input type="text" size="7" name="rome"></td>
      </tr>
      <tr>
        <td colspan="5"><center>本站時間<br><input type="text" size="7" name="local"></center></td>
      </tr>
    </table>
</form>
</center>


將以下程式碼複製,貼在插入<body >標籤裡面。

 onLoad="JavaScript:GetTime();"

uuiop6623 發表在 痞客邦 PIXNET 留言(0) 人氣()

語法展示::   http://home.graffiti.net/ikjuuopl/


請用IE6.0或更新版本觀看語法特效展示

將以下程式碼複製,貼在<body>及</body>標籤之間。


<center>
<script language="JavaScript">
<!--
function CalConv()
 {
 FIRSTYEAR = 1998;
 LASTYEAR = 2031;
 today = new Date();
 SolarYear = today.getFullYear();
 SolarMonth = today.getMonth() + 1;
 SolarDate = today.getDate();
 Weekday = today.getDay();
 LunarCal = [
  new tagLunarCal( 27,  5, 3, 43, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1 ),
  new tagLunarCal( 46,  0, 4, 48, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1 ), /* 88 */
  new tagLunarCal( 35,  0, 5, 53, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1 ), /* 89 */
  new tagLunarCal( 23,  4, 0, 59, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1 ),
  new tagLunarCal( 42,  0, 1,  4, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1 ),
  new tagLunarCal( 31,  0, 2,  9, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0 ),
  new tagLunarCal( 21,  2, 3, 14, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1 ), /* 93 */
  new tagLunarCal( 39,  0, 5, 20, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1 ),
  new tagLunarCal( 28,  7, 6, 25, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1 ),
  new tagLunarCal( 48,  0, 0, 30, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1 ),
  new tagLunarCal( 37,  0, 1, 35, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1 ), /* 97 */
  new tagLunarCal( 25,  5, 3, 41, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1 ),
  new tagLunarCal( 44,  0, 4, 46, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1 ),
  new tagLunarCal( 33,  0, 5, 51, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1 ),
  new tagLunarCal( 22,  4, 6, 56, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ), /* 101 */
  new tagLunarCal( 40,  0, 1,  2, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ),
  new tagLunarCal( 30,  9, 2,  7, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1 ),
  new tagLunarCal( 49,  0, 3, 12, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1 ),
  new tagLunarCal( 38,  0, 4, 17, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0 ), /* 105 */
  new tagLunarCal( 27,  6, 6, 23, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1 ),
  new tagLunarCal( 46,  0, 0, 28, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0 ),
  new tagLunarCal( 35,  0, 1, 33, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0 ),
  new tagLunarCal( 24,  4, 2, 38, 0, 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1 ), /* 109 */
  new tagLunarCal( 42,  0, 4, 44, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1 ),
  new tagLunarCal( 31,  0, 5, 49, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0 ),
  new tagLunarCal( 21,  2, 6, 54, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1 ),
  new tagLunarCal( 40,  0, 0, 59, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1 ), /* 113 */
  new tagLunarCal( 28,  6, 2,  5, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0 ),
  new tagLunarCal( 47,  0, 3, 10, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 1 ),
  new tagLunarCal( 36,  0, 4, 15, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1 ),
  new tagLunarCal( 25,  5, 5, 20, 1, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0 ), /* 117 */
  new tagLunarCal( 43,  0, 0, 26, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1 ),
  new tagLunarCal( 32,  0, 1, 31, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0 ),
  new tagLunarCal( 22,  3, 2, 36, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0 ) ];
 /* 民國年每月之日數 */
 SolarCal = [ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ];
 /* 民國年每月之累積日數, 平年與閏年 */
 SolarDays = [
  0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365, 396,
  0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366, 397 ];
 AnimalIdx = ["馬", "羊", "猴", "雞", "狗", "豬", "鼠", "牛", "虎", "兔", "龍", "蛇" ];
 LocationIdx = [ "南", "東", "北", "西" ];
 if ( SolarYear <= FIRSTYEAR || SolarYear > LASTYEAR ) return 1;
 sm = SolarMonth - 1;
 if ( sm < 0 || sm > 11 ) return 2;
 leap = GetLeap( SolarYear );
 if ( sm == 1 )
  d = leap + 28;
 else
  d = SolarCal[sm];
 if ( SolarDate < 1 || SolarDate > d ) return 3;
 y = SolarYear - FIRSTYEAR;
 acc = SolarDays[ leap*14 + sm ] + SolarDate;
 kc = acc + LunarCal[y].BaseKanChih;
 Kan = kc % 10;
 Chih = kc % 12;
 Location = LocationIdx[kc % 4];
 Age = kc % 60;
 if ( Age < 22 )
  Age = 22 - Age;
 else
  Age = 82 - Age;

 Animal = AnimalIdx[ Chih ];

 if ( acc <= LunarCal[y].BaseDays ) {
  y--;
  LunarYear = SolarYear - 1;
  leap = GetLeap( LunarYear );
  sm += 12;
  acc = SolarDays[leap*14 + sm] + SolarDate;
  }
 else
  LunarYear = SolarYear;
  
 l1 = LunarCal[y].BaseDays;
 for ( i=0; i<13; i++ ) {
  l2 = l1 + LunarCal[y].MonthDays[i] + 29;
  if ( acc <= l2 ) break;
  l1 = l2;
  }
 LunarMonth = i + 1;
 LunarDate = acc - l1;
 im = LunarCal[y].Intercalation;

 if ( im != 0 && LunarMonth > im ) {
  LunarMonth--;
  if ( LunarMonth == im ) LunarMonth = -im;
  }
 if ( LunarMonth > 12 ) LunarMonth -= 12;
 today=new Date();
        function initArray(){
                         this.length=initArray.arguments.length
                         for(var i=0;i<this.length;i++)
                         this[i+1]=initArray.arguments[i]  }
       var d=new initArray("<font color=#FF0000>星期日</font>","<font color=#FF8000>星期一</font>","<font color=#FF8000>星期二</font>","<font color=#FF8000>星期三</font>","<font color=#FF8000>星期四</font>","<font color=#FF8000>星期五</font>","<font color=#FF0000>星期六</font>");
             document.write("民國 <font color=#0000FF>",today.getYear()-1911,"<font color=black> 年 </font>",today.getMonth()+1,"<font color=black> 月 </font>",today.getDate(),"<font color=black> 日 </font><br>"
        ,d[today.getDay()+1],"");
   document.write( "</font><br><span class=d>農曆 <font color=#4040FF>" + LunarMonth + "</font>月 <font color=#4040FF>" + LunarDate + "</font>日</span>" );
       document.write( "<br><span class=d><font color=RED>煞</font>" + Location + "<font color=GREEN>沖</font>" + Animal + Age + "歲</span><br>" );               
 return 0;
 }
 /* 求此民國年是否為閏年, 返回 0 為平年, 1 為閏年 */
function GetLeap( year )
 {
   if ( year % 400 == 0 )
     return 1;
   else if ( year % 100 == 0 )
     return 0;
   else if ( year % 4 == 0 )
     return 1;
   else
     return 0;
 }
function tagLunarCal( d, i, w, k, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12, m13) {
 this.BaseDays = d;         /* 到民國 1 月 1 日到農曆正月初一的累積日數 */
 this.Intercalation = i;    /* 閏月月份. 0==此年沒有閏月 */
 this.BaseWeekday = w;      /* 此年民國 1 月 1 日為星期幾再減 1 */
 this.BaseKanChih = k;      /* 此年民國 1 月 1 日之干支序號減 1 */
 this.MonthDays = [ m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12, m13 ]; /* 此農曆年每月之大小, 0==小月(29日), 1==大月(30日) */
}
CalConv();
-->
</script>
</center>

uuiop6623 發表在 痞客邦 PIXNET 留言(0) 人氣()

語法展示::  http://home.graffiti.net/lyhfgghfd/


請用IE6.0或更新版本觀看語法特效展示

將以下程式碼複製,貼在<body>及</body>標籤之間。


<center>
<script language="JavaScript">
<!--
Months = new Array(12);
Months[0] = "1月";
Months[1] = "2月";
Months[2] = "3月";
Months[3] = "4月";
Months[4] = "5月";
Months[5] = "6月";
Months[6] = "7月";
Months[7] = "8月";
Months[8] = "9月";
Months[9] = "10月";
Months[10] = "11月";
Months[11] = "12月";
function PadSpaces(TheString)
{
var Spaces = " ";
len = Math.round((9 - TheString.length)/2);
return Spaces.substring(0,len) + TheString;
}
function NumLeapYears(StartYear, EndYear)
{
var LeapYears, i;
if (EndYear >= StartYear){
for(LeapYears = 0; StartYear <= EndYear; StartYear++)
if (IsLeapYear(StartYear)) LeapYears++;
}else{
for(LeapYears = 0; EndYear <= StartYear; EndYear++)
if (IsLeapYear(EndYear)) LeapYears++;
}
return LeapYears;
}
function IsLeapYear(Year)
{
if(Math.round(Year/4) == Year/4){
if(Math.round(Year/100) == Year/100){
if(Math.round(Year/400) == Year/400)
return true;
else return false;
}else return true;
}
return false;
}
function Trim(TheString)
{
var len;
len = TheString.length;
while(TheString.substring(0,1) == " "){ //trim left
TheString = TheString.substring(1, len);
len = TheString.length;
}
while(TheString.substring(len-1, len) == " "){ //trim right
TheString = TheString.substring(0, len-1);
len = TheString.length;
}
return TheString;
}
function DetermineMonthIdx()
{
var i, month, month_s, len;
month = Trim(document.calform.elements[4].value);
len = month.length;
for( i = 0; i <12; i++){
month_s = Months[i].substring(0,len);
if (month_s.toUpperCase() == month.toUpperCase())
return (i);
}
return -1;
}
function FindNewYearStartingDay(Year)
{
var LeapYears, Years, Day;
LeapYears = NumLeapYears(1995, Year);
if (Year >=1995)
Years = (Year -1995)+LeapYears;
else Years = (Year -1995)-LeapYears;
if (Year >=1995)
Day = Math.round(((Years/7 - Math.floor(Years/7))*7)+.1);
else Day = Math.round(((Years/7 - Math.ceil(Years/7))*7)-.1);
if (Year >=1995){
if(IsLeapYear(Year)) Day--;
}else Day += 7;
if(Day < 0) Day = 6;
if(Day > 6) Day = 0;
return Day;
}
function FindNumDaysInMonth(Year, Month)
{
if(Month == 1){
if(IsLeapYear(Year)) return 29;
else return 28;
}else{
if(Month >6) Month++;
if(Month/2 == Math.round(Month/2)) return 31;
}
return 30;
}
function FindMonthStartDay(NewYearDay, Year, Month)
{
var MonthStartDay;
AddArray = new Array(12);
AddArray[0]=0;AddArray[1]=3;AddArray[2]=3;AddArray[3]=6;
AddArray[4]=1;AddArray[5]=4;AddArray[6]=6;AddArray[7]=2;
AddArray[8]=5;AddArray[9]=0;AddArray[10]=3;AddArray[11]=5;
MonthStartDay = NewYearDay + AddArray[Month];
if(IsLeapYear(Year) && (Month ) > 1) MonthStartDay ++;
if (MonthStartDay > 6) MonthStartDay -= 7;
return MonthStartDay;
}
function FillCalendar()
{
var Year, Month, Midx, NewYearDay, MonthStartDay;
var NumDaysInMonth, i, t;
Year = parseFloat(document.calform.elements[1].value);
Month = document.calform.elements[4].value;
Midx = DetermineMonthIdx();
if (Midx == -1){
alert ("Can't recognize that month");
return;
}
NewYearDay = FindNewYearStartingDay(Year);
MonthStartDay = FindMonthStartDay(NewYearDay, Year, Midx);
NumDaysInMonth = FindNumDaysInMonth(Year, Midx);
for(i = 6; i < 43; i++){
t = i-5-MonthStartDay;
if ( t >= 1 && t <= NumDaysInMonth)
document.calform.elements[i].value =t;
else document.calform.elements[i].value = "";
}
}
function IncDecYear(val)
{
var valNum = parseInt(val);
var valNum2 = parseInt(document.calform.elements[1].value)
document.calform.elements[1].value = valNum2 + valNum;
FillCalendar()
}
function IncDecMonth(val)
{
var valNum = parseInt(val);
var Midx = DetermineMonthIdx();
Midx += valNum;
if(Midx > 11) Midx = 0;
if(Midx < 0) Midx = 11;
document.calform.elements[4].value = PadSpaces(Months[Midx]);
FillCalendar()
}
-->
</script>
<table border=1 bgcolor="#000000" cellpadding=1 cellspacing=1>
<table border=0 cellpadding=0 cellspacing=0>
<form name="calform">
<tr>
<td align=center cellpadding=0 cellspacing=0 bgcolor="#000000">
<input
type=button value="<<" onClick="IncDecYear(-1)" name="button">
</td>
<th cellpadding=0 cellspacing=0 bgcolor="#aaaaaa" colspan=5
align=center>
<input size=4 type=text value="1993" name="text">
</th>
<td align=center cellpadding=0 cellspacing=0 bgcolor="#000000">
<input
type=button value=">>" onClick="IncDecYear(1)" name="button2">
</td>
</tr>
<tr>
<td align=center bgcolor="#000000">
<input type=button value="<<"
onClick="IncDecMonth(-1)" name="button2">
</td>
<th bgcolor="#aaaaaa" colspan=5 align=center>
<input size=9 type=text
value=" January " name="text">
</th>
<td align=center bgcolor="#000000">
<input type=button value=">>"
onClick="IncDecMonth(1)" name="button2">
</td>
</tr>
<tr>
<th bgcolor="#ffcccc">S</th>
<th bgcolor="#ccccff">M</th>
<th bgcolor="#ccccff">T</th>
<th bgcolor="#ccccff">W</th>
<th bgcolor="#ccccff">T</th>
<th bgcolor="#ccccff">F</th>
<th bgcolor="#ccccff">S</th>
</tr>
<tr>
<td bgcolor="#ffcccc">
<input type=text size=2 name="text">
</td>
<td bgcolor="#ccccff">
<input type=text size=2 name="text">
</td>
<td bgcolor="#ccccff">
<input type=text size=2 name="text">
</td>
<td bgcolor="#ccccff">
<input type=text size=2 name="text">
</td>
<td bgcolor="#ccccff">
<input type=text size=2 name="text">
</td>
<td bgcolor="#ccccff">
<input type=text size=2 name="text">
</td>
<td bgcolor="#ccccff">
<input type=text size=2 name="text">
</td>
</tr>
<tr>
<td bgcolor="#ffcccc">
<input type=text size=2 name="text">
</td>
<td bgcolor="#ccccff">
<input type=text size=2 name="text">
</td>
<td bgcolor="#ccccff">
<input type=text size=2 name="text">
</td>
<td bgcolor="#ccccff">
<input type=text size=2 name="text">
</td>
<td bgcolor="#ccccff">
<input type=text size=2 name="text">
</td>
<td bgcolor="#ccccff">
<input type=text size=2 name="text">
</td>
<td bgcolor="#ccccff">
<input type=text size=2 name="text">
</td>
</tr>
<tr>
<td bgcolor="#ffcccc">
<input type=text size=2 name="text">
</td>
<td bgcolor="#ccccff">
<input type=text size=2 name="text">
</td>
<td bgcolor="#ccccff">
<input type=text size=2 name="text">
</td>
<td bgcolor="#ccccff">
<input type=text size=2 name="text">
</td>
<td bgcolor="#ccccff">
<input type=text size=2 name="text">
</td>
<td bgcolor="#ccccff">
<input type=text size=2 name="text">
</td>
<td bgcolor="#ccccff">
<input type=text size=2 name="text">
</td>
</tr>
<tr>
<td bgcolor="#ffcccc">
<input type=text size=2 name="text">
</td>
<td bgcolor="#ccccff">
<input type=text size=2 name="text">
</td>
<td bgcolor="#ccccff">
<input type=text size=2 name="text">
</td>
<td bgcolor="#ccccff">
<input type=text size=2 name="text">
</td>
<td bgcolor="#ccccff">
<input type=text size=2 name="text">
</td>
<td bgcolor="#ccccff">
<input type=text size=2 name="text">
</td>
<td bgcolor="#ccccff">
<input type=text size=2 name="text">
</td>
</tr>
<tr>
<td bgcolor="#ffcccc">
<input type=text size=2 name="text">
</td>
<td bgcolor="#ccccff">
<input type=text size=2 name="text">
</td>
<td bgcolor="#ccccff">
<input type=text size=2 name="text">
</td>
<td bgcolor="#ccccff">
<input type=text size=2 name="text">
</td>
<td bgcolor="#ccccff">
<input type=text size=2 name="text">
</td>
<td bgcolor="#ccccff">
<input type=text size=2 name="text">
</td>
<td bgcolor="#ccccff" >
<input type=text size=2 name="text">
</td>
</tr>
<tr>
<td bgcolor="#ffcccc">
<input type=text size=2 name="text">
</td>
<td bgcolor="#ccccff">
<input type=text size=2 name="text">
</td>
<td bgcolor="#3344aa" colspan=5>
<input type=text name="text">
</td>
</tr>
</form>
</table>
</table>
<script language=JavaScript>
<!--
myDate = new Date();
var Month = parseInt(myDate.getMonth());
document.calform.elements[1].value = myDate.getYear();
document.calform.elements[4].value = PadSpaces(Months[Month]);
document.calform.elements[43].value = "今天是民國" + (myDate.getYear()-1911) + "年" +
Months[Month].substring(0,3) +
myDate.getDate() + "日";
FillCalendar();
-->
</script>
</center>

uuiop6623 發表在 痞客邦 PIXNET 留言(0) 人氣()

語法展示::  http://home.graffiti.net/ertfhyy/


請用IE6.0或更新版本觀看語法特效展示

將以下程式碼複製,貼在<body>及</body>標籤之間。

<CENTER>
<FORM NAME="calControl" onSubmit="return false;">
<TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0>
<TR>
<TD COLSPAN=7>
<CENTER>
<INPUT NAME="year" TYPE=TEXT SIZE=3 MAXLENGTH=4>年
<SELECT NAME="month" onChange="selectDate()">
<OPTION>一月</OPTION>
<OPTION>二月</OPTION>
<OPTION>三月</OPTION>
<OPTION>四月</OPTION>
<OPTION>五月</OPTION>
<OPTION>六月</OPTION>
<OPTION>七月</OPTION>
<OPTION>八月</OPTION>
<OPTION>九月</OPTION>
<OPTION>十月</OPTION>
<OPTION>十一月</OPTION>
<OPTION>十二月</OPTION>
</SELECT>
<INPUT TYPE="button" NAME="Go" value="前往" onClick="selectDate()">
</CENTER>
</TD>
</TR>
</FORM>
<FORM NAME="calButtons">
<TR>
<TD>
<textarea FONT="Courier" NAME="calPage" WRAP=no ROWS=8 COLS=22>
</textarea>
</TD>
<TR>
<TD>
<CENTER>
<INPUT TYPE=BUTTON NAME="previousYear" VALUE="<< " onClick="setPreviousYear()">
<INPUT TYPE=BUTTON NAME="previousYear" VALUE=" < " onClick="setPreviousMonth()">
<INPUT TYPE=BUTTON NAME="previousYear" VALUE=" = " onClick="setToday()">
<INPUT TYPE=BUTTON NAME="previousYear" VALUE=" > " onClick="setNextMonth()">
<INPUT TYPE=BUTTON NAME="previousYear" VALUE=" >>" onClick="setNextYear()">
</CENTER>
</TD>
</TR>
</TABLE>
</FORM>
</CENTER> 


將以下程式碼複製,貼在<head>及</head>標籤之間。

<script language="JavaScript">
<!--
function setToday() {
var now = new Date();
var day = now.getDate();
var month = now.getMonth();
var year = now.getYear();
this.focusDay = day;
document.calControl.month.selectedIndex = month;
document.calControl.year.value = year;
displayCalendar(month, year);
}
function isFourDigitYear(year) {
if (year.length != 4) {
alert ("Sorry, the year must be four-digits in length.");
document.calControl.year.select();
document.calControl.year.focus();
} else { return true; }
}
function selectDate() {
var year = document.calControl.year.value;
if (isFourDigitYear(year)) {
var day = 0;
var month = document.calControl.month.selectedIndex;
displayCalendar(month, year);
}
}
function setPreviousYear() {
var year = document.calControl.year.value;
if (isFourDigitYear(year)) {
var day = 0;
var month = document.calControl.month.selectedIndex;
year--;
document.calControl.year.value = year;
displayCalendar(month, year);
}
}
function setPreviousMonth() {
var year = document.calControl.year.value;
if (isFourDigitYear(year)) {
var day = 0;
var month = document.calControl.month.selectedIndex;
if (month == 0) {
month = 11;
if (year >
1000) {
year--;
document.calControl.year.value = year;
}
} else { month--; }
document.calControl.month.selectedIndex = month;
displayCalendar(month, year);
}
}
function setNextMonth() {
var year = document.calControl.year.value;
if (isFourDigitYear(year)) {
var day = 0;
var month = document.calControl.month.selectedIndex;
if (month == 11) {
month = 0;
year++;
document.calControl.year.value = year;
} else { month++; }
document.calControl.month.selectedIndex = month;
displayCalendar(month, year);
}
}
function setNextYear() {
var year = document.calControl.year.value;
if (isFourDigitYear(year)) {
var day = 0;
var month = document.calControl.month.selectedIndex;
year++;
document.calControl.year.value = year;
displayCalendar(month, year);
}
}
function displayCalendar(month, year) {
month = parseInt(month);
year = parseInt(year);
var i = 0;
var days = getDaysInMonth(month+1,year);
var firstOfMonth = new Date (year, month, 1);
var startingPos = firstOfMonth.getDay();
days += startingPos;
document.calButtons.calPage.value = " Su Mo Tu We Th Fr Sa";
document.calButtons.calPage.value += "\n --------------------";
for (i = 0; i < startingPos; i++) {
if ( i%7 == 0 ) document.calButtons.calPage.value += "\n ";
document.calButtons.calPage.value += " ";
}
for (i = startingPos; i < days; i++) {
if ( i%7 == 0 ) document.calButtons.calPage.value += "\n ";
if (i-startingPos+1 < 10)
document.calButtons.calPage.value += "0";
document.calButtons.calPage.value += i-startingPos+1;
document.calButtons.calPage.value += " ";
}
for (i=days; i<42; i++) {
if ( i%7 == 0 ) document.calButtons.calPage.value += "\n ";
document.calButtons.calPage.value += " ";
}
document.calControl.Go.focus();
}
function getDaysInMonth(month,year) {
var days;
if (month==1 || month==3 || month==5 || month==7 || month==8 || month==10 || month==12) days=31;
else if (month==4 || month==6 || month==9 || month==11) days=30;
else if (month==2) {
if (isLeapYear(year)) { days=29; }
else { days=28; }
}
return (days);
}
function isLeapYear (Year) {
if (((Year % 4)==0) && ((Year % 100)!=0) || ((Year % 400)==0)) {
return (true);
} else { return (false); }
}
-->
</script>


將以下程式碼複製,貼在插入<body >標籤裡面。

 onLoad="setToday()"

uuiop6623 發表在 痞客邦 PIXNET 留言(0) 人氣()

語法展示::  http://home.graffiti.net/hbvggyy/


請用IE6.0或更新版本觀看語法特效展示

將以下程式碼複製,貼在<body>及</body>標籤之間。

<center>
<script language="JavaScript" type="text/JavaScript">
<!--
calendar();
-->
</script>
</center>


將以下程式碼複製,貼在<head>及</head>標籤之間。


<script language="JavaScript" type="text/JavaScript">
<!--
var vn="Microsoft Internet Explorer";
var some;
if(navigator.appName!=vn)
some=1900;
else
some=0;
function montharr(m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11) {
this[0] = m0;
this[1] = m1;
this[2] = m2;
this[3] = m3;
this[4] = m4;
this[5] = m5;
this[6] = m6;
this[7] = m7;
this[8] = m8;
this[9] = m9;
this[10] = m10;
this[11] = m11;
}
function calendar() {
var monthNames = "JanFebMarAprMayJunJulAugSepOctNovDec";
var today = new Date();
var thisDay;
var monthDays = new montharr(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
year = today.getYear() + 1900;
thisDay = today.getDate();
if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) monthDays[1] = 29;
nDays = monthDays[today.getMonth()];
firstDay = today;
firstDay.setDate(1); // works fine for most systems
testMe = firstDay.getDate();
if (testMe == 2) firstDay.setDate(0);
startDay = firstDay.getDay();
document.write('<table border="0" cellspacing="0" cellpadding="2" align="CENTER" bgcolor="#ffff00"><TR><TD><table border="0" cellspacing="1" cellpadding="2" bgcolor="Silver">');
document.write('<TR><th colspan="7" bgcolor="#98eb97">');
var dayNames = new Array("星期日","星期一","星期二","星期三","星期四","星期五","星期六");
var monthNames = new Array("1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月");
var now = new Date();
document.write("<font style=font-size:9pt;Color:#330099>" + "西元 " + now.getYear() + "年" + monthNames[now.getMonth()] + " " + now.getDate() + "日 " + dayNames[now.getDay()] + "</FONT>");
document.writeln('</TH></TR><TR><TH BGCOLOR="#ffff79"><font style="font-size:9pt;Color:White"><FONT COLOR="#000000">日</FONT></FONT></TH>');
document.writeln('<th bgcolor="#ffff79"><font style="font-size:9pt;Color:White"><FONT COLOR="#000000">一</FONT></FONT></TH>');
document.writeln('<TH BGCOLOR="#ffff79"><font style="font-size:9pt;Color:White"><FONT COLOR="#000000">二</FONT></FONT></TH>');
document.writeln('<TH BGCOLOR="#ffff79"><font style="font-size:9pt;Color:White"><FONT COLOR="#000000">三</FONT></FONT></TH>');
document.writeln('<TH BGCOLOR="#ffff79"><font style="font-size:9pt;Color:White"><FONT COLOR="#000000">四</FONT></FONT></TH>');
document.writeln('<TH BGCOLOR="#ffffF79"><font style="font-size:9pt;Color:White"><FONT COLOR="#000000">五</FONT></FONT></TH>');
document.writeln('<TH BGCOLOR="#ffff79"><font style="font-size:9pt;Color:White"><FONT COLOR="#000000">六</FONT></FONT></TH>');
document.writeln("</TR><TR>");
column = 0;
for (i=0; i<startDay; i++) {
document.writeln("\n<TD><FONT style=font-size:9pt> </FONT></TD>");
column++;
}
for (i=1; i<=nDays; i++) {
if (i == thisDay) {
document.writeln('</TD><td align="CENTER" bgcolor="#FFba40"><FONT style=font-size:9pt;Color:#000000><B>')
}
else {
document.writeln('</TD><TD BGCOLOR="#FFFFFF" ALIGN="CENTER"><FONT style=font-size:9pt;font-family:Arial;font-weight:bold;Color:#007d00>');
}
document.writeln(i);
if (i == thisDay) document.writeln("</FONT></TD>")
column++;
if (column == 7) {
document.writeln("<TR>");
column = 0;
}
}
document.writeln('<TR><td colspan="7" align="CENTER" valign="TOP" bgcolor="#FFFF79"><form name="clock" onSubmit="0"><FONT style=font-size:9pt;Color:#000000>現在時間:<INPUT TYPE="Text" NAME="face" ALIGN="TOP"></FONT></TD></TR></TABLE></TD></TR></TABLE></FORM>');
}
var timerID = null;
var timerRunning = false;
function stopclock ()
{
if(timerRunning)
clearTimeout(timerID);
timerRunning = false;
}
function showtime()
{
var now = new Date()
var hours = now.getHours()
var minutes = now.getMinutes()
var seconds = now.getSeconds()
var timeValue = ""
if(hours>=1 && hours <4)
{timeValue += ("凌晨")}
if(hours>=4 && hours<6)
{timeValue += ("清晨")}
if(hours>=6 && hours<9)
{timeValue += ("早上")}
if(hours>=9 && hours<12)
{timeValue += ("上午")}
if(hours>=12 && hours<13)
{timeValue += ("中午")}
if(hours>=13 && hours<18)
{timeValue += ("下午")}
if(hours>=18 && hours <19)
{timeValue += ("傍晚")}
if(hours>=19 && hours <24)
{timeValue += ("晚上")}
if(hours<1)
{timeValue += ("午夜")}
timeValue += ((hours > 12) ? hours - 12 : hours)
timeValue += ((minutes < 10) ? ":0" : ":") + minutes
timeValue += ((seconds < 10) ? ":0" : ":") + seconds
document.clock.face.value = timeValue
timerID = setTimeout("showtime()",1000)
timerRunning = true
}
function startclock ()
{
stopclock();
showtime();
}
-->
</script>


將以下程式碼複製,貼在插入<body >標籤裡面。

 onLoad="startclock(); timerONE=window.setTimeout"

uuiop6623 發表在 痞客邦 PIXNET 留言(0) 人氣()

語法展示::  http://home.graffiti.net/hydfdd/


請用IE6.0或更新版本觀看語法特效展示

將以下程式碼複製,貼在<body>及</body>標籤之間。


<center>
<script language="JavaScript">
<!--
var week = new Array("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat");
var monthdays = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
var today = new Date();
var month = today.getMonth();
var day = today.getDay();
var dayN = today.getDate();
var days = monthdays[month];
if (month == 1) {
  var year = today.getYear();
  if (year%4 == 0) days = 29;
}
document.write("<table border='0' cellspacing='0' cellpadding='0'>");
document.write("<tr>");
for (var i=0; i<7; i++) {
  document.write("<td width='30' height='30'>");
  document.write("<div align='center'>" + week[i] + "</div>");
  document.write("</td>");
}
document.write("</tr>");
var jumped = 0;
var inserted = 1;
var start = day - dayN%7 + 1;
if (start < 0) start += 7;
var weeks = parseInt((start + days)/7);
if ((start + days)%7 != 0) weeks++;
for (var i=weeks; i>0; i--) {
  document.write("<tr>");
  for (var j=7; j>0; j--) {
    document.write("<td>");
    if (jumped<start || inserted>days) {
      document.write("<div align='center'></div>");
      jumped++;
    }
    else {
      if (inserted == dayN) document.write("<div align='center'>[" + inserted + "]</div>");
      else document.write("<div align='center'>" + inserted + "</div>");
      inserted++;
    }
    document.write("</td>")
  }
  document.write("</tr>");
}
document.write("</table>");
-->
</script>
</center>

uuiop6623 發表在 痞客邦 PIXNET 留言(0) 人氣()

  • May 19 Mon 2008 11:21
  • 月曆

語法展示::  http://home.graffiti.net/rfvbhjko/


請用IE6.0或更新版本觀看語法特效展示

將以下程式碼複製,貼在<body>及</body>標籤之間。


<center>
<script language="JavaScript">
<!--
function calendar()
{
var today,year,month,thisday,nDays;
today = new Date();
year = today.getYear() + 1900;
month = today.getMonth();
thisday = today.getDate();
if (month == 1) {
if ( ((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0) ){
nDays = 29;
} else {
nDays = 28;
}
} else if ((month == 3)||(month == 5)||(month == 8)||(month == 10)){
nDays = 30;
} else {
nDays = 31;
}
firstDay = today;
firstDay.setDate(1);
startDay = firstDay.getDay();
document.write("<TABLE BORDER=2 bordercolor=#8080FF CELLSPACING=2 CELLPADDING=2>");
document.write("<TR ALIGN=center>");
document.write("<TD><FONT SIZE=2 face=arial COLOR=\"#FF0000\">星期日</FONT>");
document.write("<TD><FONT SIZE=2 face=arial color=000000>星期一</FONT>");
document.write("<TD><FONT SIZE=2 face=arial color=000000>星期二</FONT>");
document.write("<TD><FONT SIZE=2 face=arial color=000000>星期三</FONT>");
document.write("<TD><FONT SIZE=2 face=arial color=000000>星期四</FONT>");
document.write("<TD><FONT SIZE=2 face=arial color=000000>星期五</FONT>");
document.write("<TD><FONT SIZE=2 COLOR=\"#FF0000\">星期六</FONT>");
document.write("<TR ALIGN=center>");
column = 0;
for (i=0; i<startDay; i++) {
document.write("<TD>");
column++;
}
for (i=1; i<=nDays; i++) {
document.write("<TD><FONT SIZE=2 color=000000>");
if (column == 0) document.write("<FONT COLOR=\"#FF0000\">");
if (column == 6) document.write("<FONT COLOR=\"#FF0000\">");
if (i == thisday) document.write("<B><U>");
document.write(i);
if (i == thisday) document.write("</U></B>");
if (column == 7||column == 0) document.write("</FONT>");
document.write("</FONT>");
column++;
if (column == 7) {
document.write("<TR ALIGN=center>");
column = 0;
}
}
document.write("</TABLE>");
}
-->
</script>
<CENTER>
<script language="JavaScript">
<!--
calendar();
-->
</script>
</center>

uuiop6623 發表在 痞客邦 PIXNET 留言(0) 人氣()

語法展示::   http://home.graffiti.net/likoped44gf/


請用IE6.0或更新版本觀看語法特效展示

將以下程式碼複製,貼在<body>及</body>標籤之間。



<center>
<script language="JavaScript">
<!--
var enabled = 0; today = new Date();
var day; var date;
if(today.getDay()==0) day = "星 期 日"
if(today.getDay()==1) day = "星 期 一"
if(today.getDay()==2) day = "星 期 二"
if(today.getDay()==3) day = "星 期 三"
if(today.getDay()==4) day = "星 期 四"
if(today.getDay()==5) day = "星 期 五"
if(today.getDay()==6) day = "星 期 六"
document.fgColor = "000066";
date = " 中華民國 " + (today.getYear()) + " 年"+ (today.getMonth() + 1 ) + " 月 " + today.getDate() + " 日 " + day +"";
document.write("<TABLE BORDER=0 width=80 cellspacing=0 cellpadding=0 bgcolor=ffff00><TR><TD ALIGN=CENTER><FONT COLOR=000066>")
document.write(+ (today.getYear()-11) + "年");
document.write((today.getMonth()+1) + "月</FONT></TD></TR>")
document.write("<TR><TD ALIGN=CENTER><FONT SIZE=6 FACE=ARIAL COLOR=000066><b>"+ today.getDate() + "</b></FONT><FONT COLOR=000066> 日 </FONT></TD></TR>")
document.write("<TR><TD ALIGN=CENTER bgcolor=000066><FONT COLOR=ffff00>"+ day +"</FONT></TD></TR>")
document.write("</TABLE>")
-->
</script>
</center>

uuiop6623 發表在 痞客邦 PIXNET 留言(0) 人氣()

語法展示::   http://home.graffiti.net/kkyttgfdg/


請用IE6.0或更新版本觀看語法特效展示

將以下程式碼複製,貼在<body>及</body>標籤之間。

<script language="VBScript">
<!--
sub window_onLoad()
msgBox "歡迎光臨 今天是 " & date
MsgBox "現在時間為 " & time
end sub
-->
</script>

uuiop6623 發表在 痞客邦 PIXNET 留言(0) 人氣()

語法展示::   http://home.graffiti.net/kfrcdfg/


請用IE6.0或更新版本觀看語法特效展示

將以下程式碼複製,貼在<body>及</body>標籤之間。


<center>
<form name="sw">
<center>
<table border=0>
<tr>
<th><font color=red>倒數計時</font></th>
<th><font color=blue>設定時間 (分:秒)</font></th>
<td><input type="text" name="beg2" size="4" value="00:10"></td>
<td><input type="button" value="開始" onClick="Down()"></td>
<td><input type="text" name="disp2" size="5"></td>
</tr>
</table>
</center>
</form>
</center>


將以下程式碼複製,貼在<head>及</head>標籤之間。

<script language="JavaScript">
<!--
var up,down;
var min1,sec1;
var cmin1,csec1,cmin2,csec2;
function Minutes(data) {
for(var i=0;i<data.length;i++) if(data.substring(i,i+1)==":") break;
return(data.substring(0,i)); }
function Seconds(data) {
for(var i=0;i<data.length;i++) if(data.substring(i,i+1)==":") break;
return(data.substring(i+1,data.length)); }
function Display(min,sec) {
var disp;
if(min<=9) disp=" 0";
else disp=" ";
disp+=min+":";
if(sec<=9) disp+="0"+sec;
else disp+=sec;
return(disp); }
function Up() {
cmin1=0;
csec1=0;
min1=0+Minutes(document.sw.beg1.value);
sec1=0+Seconds(document.sw.beg1.value);
UpRepeat(); }
function UpRepeat() {
csec1++;
if(csec1==60) { csec1=0; cmin1++; }
document.sw.disp1.value=Display(cmin1,csec1);
if((cmin1==min1)&&(csec1==sec1)) alert("噹噹噹噹~\n\n時間到 ^_^");
else up=setTimeout("UpRepeat()",1000); }
function Down() {
cmin2=1*Minutes(document.sw.beg2.value);
csec2=0+Seconds(document.sw.beg2.value);
DownRepeat(); }
function DownRepeat() {
csec2--;
if(csec2==-1) { csec2=59; cmin2--; }
document.sw.disp2.value=Display(cmin2,csec2);
if((cmin2==0)&&(csec2==0)) alert("噹噹噹噹~\n\n時間到 ^_^");
else down=setTimeout("DownRepeat()",1000); }
-->
</script>

uuiop6623 發表在 痞客邦 PIXNET 留言(0) 人氣()

語法展示::   http://home.graffiti.net/wvbnmnkk/


請用IE6.0或更新版本觀看語法特效展示

將以下程式碼複製,貼在<body>及</body>標籤之間。

<script language="JavaScript">
<!--
var today = new Date();
var now = today.getDate();
var year = today.getYear();
if (year < 2000) year += 1900;
var month = today.getMonth();
var monarr = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) monarr[1] = "29";
document.write("<center>這個月還剩 " + (monarr[month]-now) + " 天了</center>");
-->
</script>

uuiop6623 發表在 痞客邦 PIXNET 留言(0) 人氣()

語法展示::   http://home.graffiti.net/ojuuuy/


請用IE6.0或更新版本觀看語法特效展示

將以下程式碼複製,貼在<body>及</body>標籤之間。

<center>
本站開站至今已有
<script language="JavaScript">
<!--
var now=new Date();var spday=new Date(2008,5-1,18);
a=(now.getTime()-spday.getTime())/(24*60*60*1000);a=Math.ceil(a);
document.write("<b>"+a+"</b>");
-->
</script>

</center>


(2002,1-1,2) 中修改設定的日期
2002為年份
1-1為月份(-1不能省略)
2為日期
a=(now.getTime()-spday.getTime()) 為正數語法,假如想改成倒數可修改為 a=(spday.getTime()-now.getTime())

uuiop6623 發表在 痞客邦 PIXNET 留言(0) 人氣()

語法展示::  http://home.graffiti.net/jjhhgytfff/


請用IE6.0或更新版本觀看語法特效展示

將以下程式碼複製,貼在<body>及</body>標籤之間。

<center>
距離2010年
<form name="formnow">
還剩 <input type="text" name="dd" size=3> 天
<input type="text" name="hh" size=1> 小時
<input type="text" name="mm" size=1> 分
<input type="text" name="ss" size=1> 秒
</center>


將以下程式碼複製,貼在<head>及</head>標籤之間。


<script language="JavaScript">
<!--
var DifferenceHour = -1
var DifferenceMinute = -1
var DifferenceSecond = -1
var Tday = new Date("Jan 1, 2010 23:59:59")
var daysms = 24 * 60 * 60 * 1000
var hoursms = 60 * 60 * 1000
var Secondms = 60 * 1000
var microsecond = 1000
function clock()
{
var time = new Date()
var hour = time.getHours()
var minute = time.getMinutes()
var second = time.getSeconds()
var timevalue = ""+((hour > 12) ? hour-12:hour)
timevalue +=((minute < 10) ? ":0":":")+minute
timevalue +=((second < 10) ? ":0":":")+second
timevalue +=((hour >12 ) ? " PM":" AM")
// document.formnow.now.value = timevalue
var convertHour = DifferenceHour
var convertMinute = DifferenceMinute
var convertSecond = DifferenceSecond
var Diffms = Tday.getTime() - time.getTime()
DifferenceHour = Math.floor(Diffms / daysms)
Diffms -= DifferenceHour * daysms
DifferenceMinute = Math.floor(Diffms / hoursms)
Diffms -= DifferenceMinute * hoursms
DifferenceSecond = Math.floor(Diffms / Secondms)
Diffms -= DifferenceSecond * Secondms
var dSecs = Math.floor(Diffms / microsecond)
if(convertHour != DifferenceHour) document.formnow.dd.value=DifferenceHour
if(convertMinute != DifferenceMinute) document.formnow.hh.value=DifferenceMinute
if(convertSecond != DifferenceSecond) document.formnow.mm.value=DifferenceSecond
document.formnow.ss.value=dSecs
// document.formnow.Tnow.value= DifferenceHour DifferenceMinute + DifferenceSecond + dSecs
setTimeout("clock()",1000)
}
-->
</script>


var Tday = new Date("Jan 1, 2010 23:59:59") 中修改要倒數的時間點


將以下程式碼複製,貼在插入<body >標籤裡面。

 onLoad="clock();return true"

uuiop6623 發表在 痞客邦 PIXNET 留言(0) 人氣()

語法展示::  http://home.graffiti.net/qhlhgnhv/


請用IE6.0或更新版本觀看語法特效展示

將以下程式碼複製,貼在<body>及</body>標籤之間。

<DIV class=time id=tim1
style="HEIGHT: 20px; LEFT: 200px; POSITION: absolute; TOP: 150px; WIDTH: 10px"></DIV>
<DIV class=time id=tim2
style="FILTER: flipv() alpha(opacity=20); FONT-STYLE: italic; POSITION: absolute"></DIV>


LEFT: 200px; 中修改時間距離視窗左邊的距離
TOP: 150px; 中修改時間距離視窗上面的距離


將以下程式碼複製,貼在<head>及</head>標籤之間。

<style type="text/css">
<!--
.time{font-family : Comic Sans Ms;
font-size : 14pt;font-weight : bold;color: #00008D;}
-->
</style>
<script language="JavaScript">
<!--
var ctimer;
function init(){
if (document.all){
tim2.style.left=tim1.style.posLeft;
tim2.style.top=tim1.style.posTop+tim1.offsetHeight-6;
settimes();
}
}
function settimes(){
var time= new Date();
hours= time.getHours();
mins= time.getMinutes();
secs= time.getSeconds();
if (hours<10)
hours="0"+hours;
if(mins<10)
mins="0"+mins;
if (secs<10)
secs="0"+secs;
tim1.innerHTML=hours+":"+mins+":"+secs
tim2.innerHTML=hours+":"+mins+":"+secs
ctimer=setTimeout('settimes()',960);
}
-->
</script>




將以下程式碼複製,貼在插入<body >標籤裡面。

 onload="init()"

uuiop6623 發表在 痞客邦 PIXNET 留言(0) 人氣()

語法展示::   http://home.graffiti.net/edcvvbg555hj/


請用IE6.0或更新版本觀看語法特效展示

將以下程式碼複製,貼在<body>及</body>標籤之間。

<center>
<FORM>
<INPUT TYPE="button" value="檢查停留時間" onClick="getLogoffTime()">
</FORM>
</center>


將以下程式碼複製,貼在<head>及</head>標籤之間。

<script language="JavaScript">
<!--
var onHours = " ";
var onMinutes = " ";
var onSeconds = " ";
var offHours = 0;
var offMinutes = 0;
var offSeconds = 0;
var logSeconds = 0;
var logMinutes = 0;
var logHours = 0;
var OnTimeValue = " ";
var OffTimeValue = " ";
var PageTimeValue = " ";
function getLogonTime() {
var now = new Date();
var ampm = (now.getHours() >= 12) ? " P.M." : " A.M."
var Hours = now.getHours();
Hours = ((Hours > 12) ? Hours - 12 : Hours);
var Minutes = ((now.getMinutes() < 10) ? ":0" : ":") + now.getMinutes();
var Seconds = ((now.getSeconds() < 10) ? ":0" : ":") + now.getSeconds();
OnTimeValue =(" "
+ Hours
+ Minutes
+ Seconds
+ " "
+ ampm);
onHours = now.getHours();
onMinutes = now.getMinutes();
onSeconds = now.getSeconds();
}
function getLogoffTime() {
var now = new Date();
var ampm = (now.getHours() >= 12) ? " P.M." : " A.M."
var Hours = now.getHours();
Hours = ((Hours > 12) ? Hours - 12 : Hours);
var Minutes = ((now.getMinutes() < 10) ? ":0" : ":") + now.getMinutes();
var Seconds = ((now.getSeconds() < 10) ? ":0" : ":") + now.getSeconds();
OffTimeValue =(" "
+ Hours
+ Minutes
+ Seconds
+ " "
+ ampm);
offHours = now.getHours();
offMinutes = now.getMinutes();
offSeconds = now.getSeconds();
timer();
}
function timer() {
if (offSeconds >= onSeconds) {
logSeconds = offSeconds - onSeconds; }
else {
offMinutes -= 1;
logSeconds = (offSeconds + 60) - onSeconds;
}
if (offMinutes >= onMinutes) {
logMinutes = offMinutes - onMinutes; }
else {
offHours -= 1;
logMinutes = (offMinutes + 60) - onMinutes;
}
logHours = offHours - onHours;
logHours = ((logHours < 10) ? "0" : ":") + logHours;
logMinutes = ((logMinutes < 10) ? ":0" : ":") + logMinutes;
logSeconds = ((logSeconds < 10) ? ":0" : ":") +logSeconds;
PageTimeValue =(" "
+ logHours
+ logMinutes
+ logSeconds);
displayTimes();
}
function displayTimes() {
alert("進站的時間:" +OnTimeValue+"\n\n現在的時間:"+OffTimeValue+"\n\n停留的時間:" + PageTimeValue);
}
-->
</script>


將以下程式碼複製,貼在插入<body >標籤裡面。

 onLoad="getLogonTime()"

uuiop6623 發表在 痞客邦 PIXNET 留言(0) 人氣()

語法展示::   http://home.graffiti.net/yhgtttgfr/


請用IE6.0或更新版本觀看語法特效展示

將以下程式碼複製,貼在<body>及</body>標籤之間。



<script language=JavaScript>
<!--
day = new Date();
miVisit = day.getTime();
function clock() {
today = new Date();
hrNow = today.getHours();
mnNow = today.getMinutes(); 
scNow = today.getSeconds();
miNow = today.getTime();
if (hrNow == 0) {
hour = 12;
ap = " AM";
} else if(hrNow <= 11) {
ap = " AM";
hour = hrNow;
} else if(hrNow == 12) {
ap = " PM";
hour = 12;
} else if (hrNow >= 13) {
hour = (hrNow - 12);
ap = " PM";
}
if (hrNow >= 13) {
hour = hrNow - 12;
}
if (mnNow <= 9) {
min = "0" + mnNow;
}
else (min = mnNow)
if (scNow <= 9) {
secs = "0" + scNow;
} else {
secs = scNow;
}
time = hour + ":" + min + ":" + secs + ap;
document.form.button.value = time;
self.status = time;
setTimeout('clock()', 1000);
}
function timeInfo() {
milliSince = miNow;
milliNow = miNow - miVisit;
secsVisit = Math.round(milliNow / 1000);
minsVisit = Math.round((milliNow / 1000) / 60);
alert(
"歡迎光臨爪哇島"

+"\n\n你已經在本頁停留"+minsVisit+"分"+secsVisit+"秒\n\n"+

"^_^");
}
document.write("<center><form name=\"form\">"
+ "<input type=button value=\"Click for info!\""
+ " name=button onClick=\"timeInfo()\"></form></center>");
onError = null;
clock();
-->
</script>

可自行修改訊息的內容

uuiop6623 發表在 痞客邦 PIXNET 留言(0) 人氣()

1 23