WOODBLOCK PRINTS
DIARY
SCHEDULE
GALLERY
WEB MAGAZINE
GALLERY
.
Website Design & Layout
Commentary
JavaScript
ĄDynamic Calendar
Free Source
<script> cal_bd = "black"; cal_tx = "black"; cal_bg = "beige"; sat_col = "blue"; sun_col = "red"; tdy_tx = "gold"; tdy_col = "darkblue"; noy = 10; mnname = new Array('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'); wdname = new Array('Sun','Mon','Tue','Wed','Thu','Fri','Sat'); buffer = document.location.search; buffer = buffer.replace("?",""); buffer = buffer.split("&"); query = new Array(); for (i in buffer) { buf = buffer[i].split("="); query[buf[0]] = buf[1]; } if (query['year'] && query['mon']) { y = eval(query['year']); m = eval(query['mon']) - 1; target = new Date(y,m); d = new Date(); nowyear = d.getYear(); nowmon = d.getMonth(); nowdate = d.getDate(); } else { target = new Date(); nowyear = target.getYear(); nowmon = target.getMonth(); nowdate = target.getDate(); } year = target.getYear(); mon = target.getMonth(); if (nowyear < 1900) nowyear += 1900; if (year < 1900) year += 1900; for (i = 28; i <= 31; i++) { ldate = new Date(year,mon,i); if (ldate.getMonth() == mon) ld = i; } fd = new Date(year,mon,1); fwday = fd.getDay(); ldate = new Date(year,mon,ld); lwday = ldate.getDay(); day = 1 - fwday; CAL = "<table><form><td align=center>"; CAL += "<table bgcolor=" + cal_bd + " border=0 cellpadding=0 cellspacing=0><td>"; CAL += "<table border=0 cellspacing=1>"; CAL += "<tr bgcolor=" + cal_bg + "><th colspan=7>"; CAL += "<select name=year class=mon>"; for (i = nowyear - noy; i <= nowyear + noy; i ++) if (i == year) CAL += "<option value=" + i + " selected>" + i; else CAL += "<option value=" + i + ">" + i; CAL += "</select><select name=mon class=mon>"; for (i = 1; i <= 12; i ++) if (i == mon + 1) CAL += "<option value=" + i + " selected>" + mnname[i-1]; else CAL += "<option value=" + i + ">" + mnname[i-1]; CAL += "</select> <input type=submit value='Set'>"; CAL += "</th></tr>"; CAL += "<tr bgcolor=" + cal_bg + ">"; for (i in wdname) { if (i == 0) wdname[i] = wdname[i].fontcolor(sun_col); else if (i == 6) wdname[i] = wdname[i].fontcolor(sat_col); else wdname[i] = wdname[i].fontcolor(cal_tx); CAL += "<td align=center class=wday><tt>" + wdname[i] + "</tt></td>"; } CAL += "</tr>"; while (day <= ld) { CAL += "<tr bgcolor=" + cal_bg + ">"; for (i = 0; i < 7; i ++) { if (day < 1 || day > ld) CAL += "<td><br></td>"; else { if (year == nowyear && mon == nowmon && day == nowdate) { CAL += "<td bgcolor=" + tdy_col + " align=right class=date>"; CAL += String(day).fontcolor(tdy_tx); } else { CAL += "<td align=right class=date>"; if (i == 0) CAL += String(day).fontcolor(sun_col); else if (i == 6) CAL += String(day).fontcolor(sat_col); else CAL += String(day).fontcolor(cal_tx); } CAL += "</td>"; } day ++; } CAL += "</tr>"; } CAL += "</table></td></table></td></form></table>"; document.write(CAL); >
Standard Calendar (Sample)