今月のカレンダーを表示するJavaScript


下記のプログラムを表示させたい部分にコピーして下さい。

<SCRIPT LANGUAGE="JavaScript">
<!--
	var today = new Date();
	var temp = new Date();
	var mon = temp.getMonth();

	temp.setDate(1);
	document.write('<TABLE BORDER="0" CELLSPACING="2" CELLPADDING="3" ><TR><TH COLSPAN="7" BGCOLOR="#D5FFD5">');
	document.write('<FONT FACE="Comic Sans MS" SIZE="+2" COLOR="#0080C0">' + temp.getYear() + "/" + (temp.getMonth() + 1) + "</FONT></TH></TR>");
	document.write('<TR><TH BGCOLOR="#FCCDCD"><FONT SIZE=+1 COLOR="#A00000">Sun</FONT></TH>');
	document.write('<TH BGCOLOR="#D5FFD5"><FONT SIZE=+1 COLOR="#404040">Mon</FONT></TH>');
	document.write('<TH BGCOLOR="#D5FFD5"><FONT SIZE=+1 COLOR="#404040">Tue</FONT></TH>');
	document.write('<TH BGCOLOR="#D5FFD5"><FONT SIZE=+1 COLOR="#404040">Wed</FONT></TH>');
	document.write('<TH BGCOLOR="#D5FFD5"><FONT SIZE=+1 COLOR="#404040">Thu</FONT></TH>');
	document.write('<TH BGCOLOR="#D5FFD5"><FONT SIZE=+1 COLOR="#404040">Fly</FONT></TH>');
	document.write('<TH BGCOLOR="#D2FFFF"><FONT SIZE=+1 COLOR="#0000A0">Sat</FONT></TH></TR>');

	for (i = 0; i < temp.getDay(); i++) { document.write('<TD BGCOLOR="E0E0E0"> </TD>'); }
	while (mon == temp.getMonth()) {
		if (temp.getDay() == 0) { document.write("</TR><TR>"); }
		if (temp.getDate() == today.getDate()) {
			document.write('<TH BGCOLOR="#80FF80"><FONT SIZE=+1 COLOR="#000000">' + temp.getDate() + "</FONT></TH>");
		} else {
			document.write('<TH BGCOLOR="#FFFFFF"><FONT SIZE=+1 COLOR="#000000">' + temp.getDate() + "</FONT></TH>");
		}
		temp.setTime(temp.getTime() + 24 * 3600 * 1000);
	}
	if (temp.getDay() != 0) {
		for (i = 0; i < 7 - temp.getDay(); i++) { document.write('<TD BGCOLOR="#E0E0E0"> </TD>'); }
	}
	document.write("</TR></TABLE>");
// -->
</SCRIPT>

ホームへ戻る