#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>
#2
複製上列語法 - 蛙 (Administrator) 發表於 25-5-2013 16:20
<form name="copy">
<textarea cols="40" name="txt" rows="4" style="BACKGROUND-COLOR:#ffffff; COLOR:#000000; FONT-SIZE:9pt">
<SCRIPT LANGUAGE="JavaScript">
//Specify bgcolor of calendar
var bg="#CCEEFF"
//Specify font size
var fs=2
var flg = 0;
//var fs = 1;
M = new Array("January","February","March","April","May","June","July","August","September","October","November","December"

;
D = new Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat"

;
function getBgn() {
pdy = new Date(); // today
pmo = pdy.getMonth(); // present month
pyr = pdy.getYear(); // present year
if (pyr < 2000) // Y2K Fix, Isaac Powell
pyr = pyr + 1900;
yr = yr1 = (pmo==0?pyr-1:pyr); // last month's year
mo = (pmo==0?11:pmo-1); // last month
bgn = new Date(M[mo]+" 1,"+yr1); // assign to date
document.write('<TABLE BORDER=0><TR><TD VALIGN=TOP>');
Calendar(); // Send last month to screen
document.write('</TD><TD VALIGN=TOP>');
yr = pyr; // present year
mo = pmo; // present month
bgn = new Date(M[mo]+" 1,"+yr); // assign to date
Calendar(); // Send this month to screen
document.write('</TD><TD VALIGN=TOP>');
yr = (pmo==11?pyr+1:pyr); // next month's year
mo = (pmo==11?0:pmo+1); // next month
bgn = new Date(M[mo]+" 1,"+yr); // assign to date
Calendar(); // Send next month to screen
document.write('</TD></TR></TABLE>'); // Finish up
}
function Calendar(){
dy = bgn.getDay();
yr = eval(yr);
d = "312831303130313130313031";
if (yr / 4 == Math.floor(yr / 4)) {
d = d.substring(0, 2) + "29" + d.substring(4, d.length);
}
pos = (mo * 2);
ld = eval(d.substring(pos, pos + 2));
document.write("<TABLE BORDER=1"
+ " BGCOLOR='" + bg
+ "'><TR><TD ALIGN=CENTER COLSPAN=7>"
+ "<FONT SIZE=" + fs + ">" + M[mo] + " " + yr
+ "</FONT></TD></TR><TR><TR>"

;
for (var i = 0;i < 7;i ++) {
document.write("<TD ALIGN=CENTER>"
+"<FONT SIZE="+fs+">" + D
+ "</FONT></TD>"
;
}
document.write("</TR><TR>"
;
ctr = 0;
for (var i = 0;i < 7; i++){
if (i < dy) {
document.write("<TD ALIGN=CENTER>"
+"<FONT SIZE=" + fs + "> </FONT>"
+"</TD>");
}
else {
ctr++;
document.write("<TD ALIGN=CENTER>"
+ "<FONT SIZE=" + fs + ">" + ctr + "</FONT>"
+ "</TD>");
}
}
document.write("</TR><TR>");
while (ctr < ld) {
for (var i = 0;i < 7; i++){
ctr++;
if (ctr > ld){
document.write("<TD ALIGN=CENTER>"
+ " </TD>");
}
else {
document.write("<TD ALIGN=CENTER>"
+ "<FONT SIZE=" + fs + ">" + ctr + "</FONT>"
+ "</TD>");
}
}
document.write("</TR><TR>");
}
document.write("</TR></TABLE>");
}
</SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
getBgn();
</SCRIPT>
</textarea><br>
<input onclick="javascript:this.form.txt.focus();this.form.txt.select();" type="button" value="全選">
</form>
<br>
<script type="text/javascript"><!--
google_ad_client = "ca-pub-4078143172638881";
/* 336X280 */
google_ad_slot = "3268225205";
google_ad_width = 336;
google_ad_height = 280;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>