»
AnglaisFran�aisVietnamien

Imprimer - Toute mois calendrier script - JavaScriptBank.com

Version compl�te: jsB@nk » Heure » Calendrier » Toute mois calendrier script
URL: https://www.javascriptbank.com/any-month-calendar-script.html

Toute mois calendrier script © JavaScriptBank.comCe calendrier, construit en utilisant un texte, vous permet de rechercher le Calendrier pour un mois de l'année! Utilisez le menu déroulant JavaScript menu pour sélectionner le mois. Tout à fait exceptionnel.

Version compl�te: jsB@nk » Heure » Calendrier » Toute mois calendrier script
URL: https://www.javascriptbank.com/any-month-calendar-script.html



JavaScript
<SCRIPT language=JavaScript>// Any-Month calendar script- Rob Patrick ([email protected])function setToday() {var now   = new Date();var day   = now.getDate();var month = now.getMonth();var year  = now.getYear();if (year < 2000)    // Y2K Fix, Isaac Powellyear = year + 1900; // http://onyx.idbsu.edu/~ipowellthis.focusDay = day;document.calControl.month.selectedIndex = month;document.calControl.year.value = year;displayCalendar(month, year);}function isFourDigitYear(year) {if (year.length != 4) {alert ("Sorry, the year must be four-digits in length.");document.calControl.year.select();document.calControl.year.focus();} else { return true; }}function selectDate() {var year  = document.calControl.year.value;if (isFourDigitYear(year)) {var day   = 0;var month = document.calControl.month.selectedIndex;displayCalendar(month, year);    }}function setPreviousYear() {var year  = document.calControl.year.value;if (isFourDigitYear(year)) {var day   = 0;var month = document.calControl.month.selectedIndex;year--;document.calControl.year.value = year;displayCalendar(month, year);   }}function setPreviousMonth() {var year  = document.calControl.year.value;if (isFourDigitYear(year)) {var day   = 0;var month = document.calControl.month.selectedIndex;if (month == 0) {month = 11;if (year > 1000) {year--;document.calControl.year.value = year;}} else { month--; }document.calControl.month.selectedIndex = month;displayCalendar(month, year);   }}function setNextMonth() {var year  = document.calControl.year.value;if (isFourDigitYear(year)) {var day   = 0;var month = document.calControl.month.selectedIndex;if (month == 11) {month = 0;year++;document.calControl.year.value = year;} else { month++; }document.calControl.month.selectedIndex = month;displayCalendar(month, year);   }}function setNextYear() {var year = document.calControl.year.value;if (isFourDigitYear(year)) {var day = 0;var month = document.calControl.month.selectedIndex;year++;document.calControl.year.value = year;displayCalendar(month, year);   }}function displayCalendar(month, year) {       month = parseInt(month);year = parseInt(year);var i = 0;var days = getDaysInMonth(month+1,year);var firstOfMonth = new Date (year, month, 1);var startingPos = firstOfMonth.getDay();days += startingPos;document.calButtons.calPage.value  =   " Su Mo Tu We Th Fr Sa";document.calButtons.calPage.value += "\n --------------------";for (i = 0; i < startingPos; i++) {if ( i%7 == 0 ) document.calButtons.calPage.value += "\n ";document.calButtons.calPage.value += "   ";}for (i = startingPos; i < days; i++) {if ( i%7 == 0 ) document.calButtons.calPage.value += "\n ";if (i-startingPos+1 < 10)document.calButtons.calPage.value += "0";document.calButtons.calPage.value += i-startingPos+1;document.calButtons.calPage.value += " ";}for (i=days; i<42; i++)  {if ( i%7 == 0 ) document.calButtons.calPage.value += "\n ";document.calButtons.calPage.value += "   ";}document.calControl.Go.focus();}function getDaysInMonth(month,year)  {var days;if (month==1 || month==3 || month==5 || month==7 || month==8 || month==10 || month==12)  days=31;else if (month==4 || month==6 || month==9 || month==11) days=30;else if (month==2)  {if (isLeapYear(year)) { days=29; }else { days=28; }}return (days);}function isLeapYear (Year) {if (((Year % 4)==0) && ((Year % 100)!=0) || ((Year % 400)==0)) {return (true);} else { return (false); }}// End --></SCRIPT><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<BODY onload=setToday()><FORM name=calControl onsubmit="return false;"><TABLE cellSpacing=0 cellPadding=0 border=0>  <TBODY>  <TR>    <TD colSpan=7><SELECT onchange=selectDate() name=month> <OPTION         selected>January<OPTION>February<OPTION>March<OPTION>April<OPTION>May<OPTION>June<OPTION>July<OPTION>August<OPTION>September<OPTION>October<OPTION>November<OPTION>December</OPTION></SELECT>       <INPUT maxLength=4 size=4 name=year> <INPUT onclick=selectDate() type=button value=Build! name=Go> </TD></TR></FORM>  <FORM name=calButtons>  <TR>    <TD><TEXTAREA name=calPage rows=8 wrap=no cols=24 FONT="Courier"></TEXTAREA></TD>  <TR>    <TD><INPUT onclick=setPreviousYear() type=button value=" <<  " name=previousYear> <INPUT onclick=setPreviousMonth() type=button value="  <  " name=previousYear> <INPUT onclick=setToday() type=button value=Today name=previousYear> <INPUT onclick=setNextMonth() type=button value="  >  " name=previousYear> <INPUT onclick=setNextYear() type=button value="  >> " name=previousYear>     </TD></TR></TBODY></TABLE></FORM></FONT></BODY><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->