Created
October 19, 2014 06:06
-
-
Save Takazudo/c91e6f753a0d6fb8e1ed to your computer and use it in GitHub Desktop.
Revisions
-
Takazudo created this gist
Oct 19, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,47 @@ <script type="text/javascript"><!-- function doCal(xxx) { var now = new Date(); now.setMonth(xxx-1); var year = now.getFullYear(); var month = now.getMonth() + 1; var today = now.getDate(); now.setDate(1); var startDay = now.getDay(); var monthdays = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); var dateMax = monthdays[month - 1]; if (month == 2 && ((year%4 == 0 && year%100 != 0) || year%400 == 0)) dateMax = 29; var days = new Array("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"); document.write("<table>"); document.write("<tr><th>" + days[0] + "</th>"); for (i=1; i<6; i++) document.write("<th>" + days[i] + "</th>"); console.log('hoge'); document.write("<th bgcolor='#add8e6'>" + days[6] + "</th></tr>\n"); var col=0; if (startDay > 0) { document.write("<tr>"); for ( ; col<startDay; col++) document.write("<td> </td>"); } for (i=1; i<=dateMax; i++) { if (col == 0) document.write("<tr>"); if (i == today) document.write("<td bgcolor='#ffc3ce'>" + i + "</td>"); else document.write("<td>" + i + "</td>"); if (col == 6) { document.write("</tr>\n"); col=0; } else col++; } if (col != 0) { for ( ; col<7; col++) document.write("<td> </td>"); document.write("</tr>"); } document.write("</table>"); } for(var j=1; j<=12; j+=1) { console.log(j); doCal(j); } //--> </script>