查看完整版本: 每季月曆 (顯示三個月)

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>&nbsp;</P>
<P><FONT color=blue></FONT>&nbsp;</P>
<P><FONT color=blue></FONT>&nbsp;</P>
<P><FONT color=#0000ff></FONT>&nbsp;</P>
<P><FONT color=#0000ff></FONT>&nbsp;</P>
<P><FONT color=#0000ff></FONT>&nbsp;</P>
<P>&nbsp;</P>
<P><FONT color=blue>&lt;SCRIPT LANGUAGE="JavaScript"&gt;</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();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // today<BR>pmo = pdy.getMonth();&nbsp;&nbsp;&nbsp; // present month<BR>pyr = pdy.getYear();&nbsp;&nbsp;&nbsp;&nbsp; // present year<BR>if (pyr &lt; 2000)&nbsp;&nbsp;&nbsp; // 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);&nbsp; // last month<BR>bgn = new Date(M[mo]+" 1,"+yr1); // assign to date<BR>document.write('&lt;TABLE BORDER=0&gt;&lt;TR&gt;&lt;TD VALIGN=TOP&gt;');<BR>Calendar();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Send last month to screen<BR>document.write('&lt;/TD&gt;&lt;TD VALIGN=TOP&gt;');<BR>yr = pyr;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // present year<BR>mo = pmo;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // present month<BR>bgn = new Date(M[mo]+" 1,"+yr); // assign to date<BR>Calendar();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Send this month to screen<BR>document.write('&lt;/TD&gt;&lt;TD VALIGN=TOP&gt;');<BR>yr = (pmo==11?pyr+1:pyr); // next month's year<BR>mo = (pmo==11?0:pmo+1);&nbsp;&nbsp; // next month<BR>bgn = new Date(M[mo]+" 1,"+yr); // assign to date<BR>Calendar();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Send next month to screen<BR>document.write('&lt;/TD&gt;&lt;/TR&gt;&lt;/TABLE&gt;'); // 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("&lt;TABLE BORDER=1"<BR>+ " BGCOLOR='" + bg<BR>+ "'&gt;&lt;TR&gt;&lt;TD ALIGN=CENTER COLSPAN=7&gt;"<BR>+ "&lt;FONT SIZE=" + fs + "&gt;" + M[mo] + " " + yr<BR>+ "&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TR&gt;");<BR>for (var i = 0;i &lt; 7;i ++) {<BR>document.write("&lt;TD ALIGN=CENTER&gt;"<BR>+"&lt;FONT SIZE="+fs+"&gt;" + D[i] + "&lt;/FONT&gt;&lt;/TD&gt;");<BR>}<BR>document.write("&lt;/TR&gt;&lt;TR&gt;");<BR>ctr = 0;<BR>for (var i = 0;i &lt; 7; i++){<BR>if (i &lt; dy) {<BR>document.write("&lt;TD ALIGN=CENTER&gt;"<BR>+"&lt;FONT SIZE=" + fs + "&gt; &lt;/FONT&gt;"<BR>+"&lt;/TD&gt;");<BR>}<BR>else {<BR>ctr++;<BR>document.write("&lt;TD ALIGN=CENTER&gt;"<BR>+ "&lt;FONT SIZE=" + fs + "&gt;" + ctr + "&lt;/FONT&gt;"<BR>+ "&lt;/TD&gt;");<BR>&nbsp;&nbsp; }<BR>}<BR>document.write("&lt;/TR&gt;&lt;TR&gt;");<BR>while (ctr &lt; ld) {<BR>for (var i = 0;i &lt; 7; i++){<BR>ctr++;<BR>if (ctr &gt; ld){<BR>document.write("&lt;TD ALIGN=CENTER&gt;"<BR>+ " &lt;/TD&gt;");<BR>}<BR>else {<BR>document.write("&lt;TD ALIGN=CENTER&gt;"<BR>+ "&lt;FONT SIZE=" + fs + "&gt;" + ctr + "&lt;/FONT&gt;"<BR>+ "&lt;/TD&gt;");<BR>&nbsp;&nbsp; }<BR>}<BR>document.write("&lt;/TR&gt;&lt;TR&gt;");<BR>}<BR>document.write("&lt;/TR&gt;&lt;/TABLE&gt;");<BR>}</FONT></P>
<P><FONT color=blue>&lt;/SCRIPT&gt;</FONT></P>
<P><FONT color=blue>&lt;SCRIPT LANGUAGE="JavaScript"&gt;</FONT></P>
<P><FONT color=blue>getBgn();</FONT></P>
<P><FONT color=blue>&lt;/SCRIPT&gt;</FONT></P>

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[i] + "</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>
頁: [1]
查看完整版本: 每季月曆 (顯示三個月)