»
EnglishFrenchVietnamese

Print - Event Calendar script - JavaScriptBank.com

Full version: jsB@nk » Time » Calendar » Event Calendar script
URL: https://www.javascriptbank.com/event-calendar-script.html

Event Calendar script © JavaScriptBank.comThe Calendar is set either manually or by clicking on a increment button. If a month is selected or a year typed, click the Get Date button. The Today button returns the Calendar to this month.Events are easily set, as per instructions, in the code. They may be set to repeat every year, and/or every month. Multiple events display on a date. Today's events show in the banner.

Full version: jsB@nk » Time » Calendar » Event Calendar script
URL: https://www.javascriptbank.com/event-calendar-script.html



JavaScript
<SCRIPT language=Javascript><!-- Original Programmed by Ira Sterbakov - irasterb@erols.com 11/1/04 -->mP = new Array("January","February","March","April","May","June","July","August","September","October","November","December");// Set an Array for each event. Month (Jan is 1, 0 is repeating), date, year or 0 for recurring and then event.//The last number is the ID number of a Div section with more information//Id numbers can be skipped and do not have to be in order. The Divs are at the bottom.//It doesn't have to be in date order.var rV1 = new Array(10,21,0,"Our Aniversary",0);var rV2 = new Array(5,30,0,"Lilly's Birthday",0);var rV3 = new Array(1,19,0,"Mom's Birthday",0);var rV4 = new Array(8,4,0,"Rick's Birthday",0);var rV5 = new Array(11,28,2004,"Dentist 1 PM",3);var rV6 = new Array(0,28,0,"Send Rent",1);var rV7 = new Array(0,15,0,"JSBank",4);// Set rDe to the number of rV arrays.var rDe = 7var hr = -1; var nD = -1;function STimit(){var today = new Date();if ( hr != today.getHours()){if ( nD != today.getDate()){nFY = today.getFullYear(); nM = today.getMonth(); nD = today.getDate();todayA = new Date(nFY,nM,nD,4,0,0); endofyear = new Date(nFY-1, 11, 31,6,0,0);Tday = Math.ceil((todayA.getTime()-endofyear.getTime())/(1000*60*60*24)); W1day = Tday;if( endofyear.getDay() <6) W1day += endofyear.getDay() + 1;Week = Math.ceil((W1day)/7);Mesi = " ";for (ir = 1; ir <= rDe; ir++){eval("Rm = rV" + ir + "[0] - 1; Rd = rV" + ir +"[1];Ry = rV" + ir + "[2];");if ( (Rm == -1 || Rm == nM) && Rd == nD && (Ry == 0 || Ry == nFY)){eval("Ri = rV" + ir + "[4]");if(Ri == 0) Mesi += ("<br>" + eval("rV" + ir + "[3]"));else Mesi += ("<br><a href='javascript: InstShow("+eval(Ri)+")'>"+eval("rV" +ir+"[3]")+"</a>");}}Mese = (" - Day " + Tday + " - Calendar Week " + Week + Mesi)}hr = today.getHours();gr = "Morning"; if (hr >= 12) gr = "Afternoon"; if (hr >= 18) gr = "Evening";Mesb = ("Good " + gr +" on<br>")}document.getElementById('Timit').innerHTML = (Mesb + today.toLocaleString() + Mese);setTimeout('STimit()',1000);}function MCDate(c){var km = document.CalForm.month.selectedIndex + c;if (km < 0 ) {km = km + 12;document.CalForm.year.value--;}if (km > 11) {km = km - 12;document.CalForm.year.value++;}document.CalForm.month.selectedIndex = km;VMonth();}function SToday(){document.CalForm.month.selectedIndex = (new Date()).getMonth();document.CalForm.year.value = (new Date()).getFullYear();VMonth();}function VMonth(){var mh = document.CalForm.month.selectedIndex;var yr = document.CalForm.year.value;if (yr < 1583) {alert("Years under 1583 not allowed");return false;}var MSDay = (new Date(yr, mh, 1)).getDay();var days = 31;if (mh == 3 || mh == 5 || mh == 8 || mh == 10) days=30;if (mh == 1){if (((yr % 4)==0) && ((yr % 100)!=0) || ((yr % 400)==0)) {days = 29;}else { days = 28; }}var ki= 1; var ke = MSDay + days;for (i = 0; i < 42; i++){if (i > (MSDay - 1) && i < ke){var Mes2 = "";for (ir = 1; ir <= rDe; ir++){eval("Rm = rV" + ir + "[0] - 1; Rd = rV" + ir +"[1];Ry = rV" + ir + "[2];");if ( (Rm == -1 || Rm == mh) && Rd == ki && (Ry ==0 || Ry ==yr)){eval("Ri = rV" + ir + "[4]");if(Ri == 0) Mes2 += ("<br>" + eval("rV" + ir + "[3]"));else Mes2 += ("<br><a href='javascript: InstShow("+eval(Ri)+")'>"+eval("rV" +ir+"[3]")+"</a>");}}Mes2 = ("<b>" + ki + "<font size=1>" + Mes2 + "</font></b>");eval("document.getElementById('m0n" + i + "').innerHTML =Mes2");ki++;}else {eval("document.getElementById('m0n" + i + "').innerHTML = '&nbsp;'");}}eval("document.getElementById('H0').innerHTML = '" + mP[mh] + ", " + yr + "'" );}</SCRIPT><!-- BEGIN INSTRUCTIONS --><SCRIPT language=Javascript><!-- Another function by Ira --><!-- Original Programmed by Ira Sterbakov - irasterb@erols.com 11/1/04 --><!-- Please keep credit in script --><!-- May be freely used and modified - email notification would be nice -->// Should be at least one more InSw than messages. 0 is reserved for the instructionsvar InSw = new Array(0,0,0,0,0,0,0,0,0);function InstShow(IP){var DI = 'dID' + IP;if ( InSw[IP] == 0 ) {document.getElementById(DI).style.display = 'block';InSw[IP]=1;}else {document.getElementById(DI).style.display = 'none';InSw[IP]=0;}}</SCRIPT><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<DIV id=Timit align=center></DIV><A href="javascript:%20InstShow(0)">Click to turn on/off instructions</A><BR><DIV id=dID0 style="DISPLAY: none"><FONT color=#800000>CALENDAR</FONT><BR>The Calendar is set either manually or by clicking on a increment button. If a month is selected or a year typed, click the Get Date button. The Today button returns the Calendar to this month.<BR><FONT color=#800000>EVENTS</FONT><BR>Events are easily set, as per instructions, in the code. They may be set to repeat every year, and/or every month. Multiple events display on a date. Today&#39;s events show in the banner.<BR><FONT color=#800000>MORE INFORAMTION</FONT><BR>More information can be listed for events. The information is at the bottom, and is on/off when event is clicked. If the event is today, it&#39;s linked in the banner section also.<BR></DIV><FORM name=CalForm><P align=center><INPUT style="FONT-WEIGHT: bold; COLOR: white; BACKGROUND-COLOR: #b88060" onclick=MCDate(-1) type=button value="<<" name=MN> <SELECT style="FONT-WEIGHT: bold; COLOR: #b88060" name=month></SELECT> <INPUT style="FONT-WEIGHT: bold; COLOR: white; BACKGROUND-COLOR: #b88060" onclick=MCDate(1) type=button value=">>" name=MP> <INPUT style="FONT-WEIGHT: bold; COLOR: white; BACKGROUND-COLOR: #b88060" onclick=document.CalForm.year.value--;VMonth() type=button value="<<" name=YN> <INPUT style="FONT-WEIGHT: bold; COLOR: #b88060" maxLength=4 size=4 name=year> <INPUT style="FONT-WEIGHT: bold; COLOR: white; BACKGROUND-COLOR: #b88060" onclick=document.CalForm.year.value++;VMonth() type=button value=">>" name=YP> <INPUT style="FONT-WEIGHT: bold; COLOR: white; BACKGROUND-COLOR: #b88060" onclick=VMonth() type=button value="Get Date" name=new> <INPUT style="FONT-WEIGHT: bold; COLOR: white; BACKGROUND-COLOR: #b88060" onclick=SToday() type=button value=Today! name=old></P></FORM><SCRIPT language=Javascript>document.write("<table border=1 style='font-family: Arial; font-weight: bold; font-size: 24'>");document.write("<tr><td align=center id='H0' bgcolor=#B88060 height=35>df</td></tr><tr><td>");document.write("<table border=1 cellpadding=4 bgcolor=#fff0d0>");document.write("<tr bgcolor=tan align=center style='color: #0000ff; font-weight: bold'>");document.write("<td><font color=#f0000>S</font></td><td>M</td><td>T</td>");document.write("<td>W</td><td>T</td><td>F</td><td>S</td></tr>");for (k = 0; k < 42; k = k + 7){document.write("<tr height=75 align=left valign=top>");document.write("<td width=80 style='color: #f00000' id='m0n" + k + "'> </td>");for (ic = k + 1; ic < k + 7; ic++) {document.write("<td width=80 id='m0n" + ic + "'> </td>");}}document.write("</tr></table></tr></table>");</SCRIPT><!-- END VMONTH SECTION --><!-- Begin Init SECTION --><SCRIPT language=Javascript>for (ims = 0; ims <12; ims++) {CalForm.month.options[ims] = new Option(mP[ims],mP[ims]);}SToday();STimit();</SCRIPT><!-- BEGIN MORE INFO, SEE INSTRUCTIONS FOR FUNCTION --><!-- id DiD0 is reserved for instrucitons --><DIV id=dID1 style="DISPLAY: none"><FONT color=#800000>Rent</FONT><BR>The rent must be sent by the 28th to get to the landlord on time.<BR></DIV><DIV id=dID3 style="DISPLAY: none"><FONT color=#800000>Dentist</FONT><BR>Dr. Puller will extract tooth. No Booze after midnight.<BR>12 Ache Dr.<BR></DIV><DIV id=dID4 style="DISPLAY: none"><font color="#800000">JSBank</font><BR>Check the new JavaScripts at <A href="http://jsbank.beplaced.com/" target=_blank><B><FONT color=red size=+1>J</FONT></B></A><a href="http://jsbank.beplaced.com/"><font size="+1" color="#FF0000">SBank</font></a> for the latest ideas.<BR></DIV><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->