語法展示::   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 發表在 痞客邦 留言(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 發表在 痞客邦 留言(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 發表在 痞客邦 留言(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 發表在 痞客邦 留言(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 發表在 痞客邦 留言(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 發表在 痞客邦 留言(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 發表在 痞客邦 留言(0) 人氣()

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


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

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

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


uuiop6623 發表在 痞客邦 留言(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 發表在 痞客邦 留言(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 發表在 痞客邦 留言(0) 人氣()