#1 每季月曆 (顯示三 ... - 蛙 (Administrator) 發表於 26-5-2012 10:35
<FONT color=blue><P><FONT color=#0000ff size=3>如不能顯示語法效果,可貼去本站</FONT><A href="http://www.bunbun000.com/html/index.htm" target=_blank><FONT color=red size=3>語法測試板</FONT></A><FONT color=#0000ff size=3>試看</FONT></P></FONT>
<P><FONT color=blue></FONT> </P>
<P><FONT color=blue></FONT> </P>
<P><FONT color=blue></FONT> </P>
<P><FONT color=#0000ff></FONT> </P>
<P><FONT color=#0000ff></FONT> </P>
<P><FONT color=#0000ff></FONT> </P>
<P> </P>
<P><FONT color=blue><SCRIPT LANGUAGE="JavaScript"></FONT></P>
<P><FONT color=blue>//Specify bgcolor of calendar<BR>var bg="#CCEEFF"</FONT></P>
<P><FONT color=blue>//Specify font size<BR>var fs=2</FONT></P>
<P><FONT color=blue>var flg = 0;<BR>//var fs = 1;<BR>M = new Array("January","February","March","April","May","June","July","August","September","October","November","December"<BR>D = new Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat"<BR>function getBgn() {<BR>pdy = new Date(); // today<BR>pmo = pdy.getMonth(); // present month<BR>pyr = pdy.getYear(); // present year<BR>if (pyr < 2000) // Y2K Fix, Isaac Powell<BR>pyr = pyr + 1900; <BR>yr = yr1 = (pmo==0?pyr-1:pyr); // last month's year<BR>mo = (pmo==0?11:pmo-1); // last month<BR>bgn = new Date(M[mo]+" 1,"+yr1); // assign to date<BR>document.write('<TABLE BORDER=0><TR><TD VALIGN=TOP>');<BR>Calendar(); // Send last month to screen<BR>document.write('</TD><TD VALIGN=TOP>');<BR>yr = pyr; // present year<BR>mo = pmo; // present month<BR>bgn = new Date(M[mo]+" 1,"+yr); // assign to date<BR>Calendar(); // Send this month to screen<BR>document.write('</TD><TD VALIGN=TOP>');<BR>yr = (pmo==11?pyr+1:pyr); // next month's year<BR>mo = (pmo==11?0:pmo+1); // next month<BR>bgn = new Date(M[mo]+" 1,"+yr); // assign to date<BR>Calendar(); // Send next month to screen<BR>document.write('</TD></TR></TABLE>'); // Finish up<BR>}<BR>function Calendar(){<BR>dy = bgn.getDay();<BR>yr = eval(yr);<BR>d = "312831303130313130313031";<BR>if (yr / 4 == Math.floor(yr / 4)) {<BR>d = d.substring(0, 2) + "29" + d.substring(4, d.length);<BR>}<BR>pos = (mo * 2);<BR>ld = eval(d.substring(pos, pos + 2));<BR>document.write("<TABLE BORDER=1"<BR>+ " BGCOLOR='" + bg<BR>+ "'><TR><TD ALIGN=CENTER COLSPAN=7>"<BR>+ "<FONT SIZE=" + fs + ">" + M[mo] + " " + yr<BR>+ "</FONT></TD></TR><TR><TR>"<BR>for (var i = 0;i < 7;i ++) {<BR>document.write("<TD ALIGN=CENTER>"<BR>+"<FONT SIZE="+fs+">" + D + "</FONT></TD>"<BR>}<BR>document.write("</TR><TR>"<BR>ctr = 0;<BR>for (var i = 0;i < 7; i++){<BR>if (i < dy) {<BR>document.write("<TD ALIGN=CENTER>"<BR>+"<FONT SIZE=" + fs + "> </FONT>"<BR>+"</TD>");<BR>}<BR>else {<BR>ctr++;<BR>document.write("<TD ALIGN=CENTER>"<BR>+ "<FONT SIZE=" + fs + ">" + ctr + "</FONT>"<BR>+ "</TD>");<BR> }<BR>}<BR>document.write("</TR><TR>");<BR>while (ctr < ld) {<BR>for (var i = 0;i < 7; i++){<BR>ctr++;<BR>if (ctr > ld){<BR>document.write("<TD ALIGN=CENTER>"<BR>+ " </TD>");<BR>}<BR>else {<BR>document.write("<TD ALIGN=CENTER>"<BR>+ "<FONT SIZE=" + fs + ">" + ctr + "</FONT>"<BR>+ "</TD>");<BR> }<BR>}<BR>document.write("</TR><TR>");<BR>}<BR>document.write("</TR></TABLE>");<BR>}</FONT></P>
<P><FONT color=blue></SCRIPT></FONT></P>
<P><FONT color=blue><SCRIPT LANGUAGE="JavaScript"></FONT></P>
<P><FONT color=blue>getBgn();</FONT></P>
<P><FONT color=blue></SCRIPT></FONT></P>