首页 > 代码库 > 让你选择自己需要的日历
让你选择自己需要的日历
<!--要完成此效果需要三个步骤第一步:把如下代码加入到<head>中--格栅除污机-石家庄展柜><SCRIPT LANGUAGE="JavaScript"><!--function displayCalendar(init) {var i;var now = new Date();var nowYear = now.getYear() - 95;var nowMonth = now.getMonth();var nowDay = now.getDate();// on open of documentif (init==1) {document.calControl.month.selectedIndex = nowMonth;document.calControl.year.selectedIndex = nowYear;}var month=document.calControl.month.selectedIndexvar year=document.calControl.year.selectedIndex+1995var days=getDaysInMonth(month+1,year);var firstOfMonth = new Date (year, month, 1);var startingPos=firstOfMonth.getDay()+7;days+=startingPos;// label days of weeki=0;document.calButtons.elements[i++].value = " S ";document.calButtons.elements[i++].value = " M ";document.calButtons.elements[i++].value = " T ";document.calButtons.elements[i++].value = " W ";document.calButtons.elements[i++].value = " T ";document.calButtons.elements[i++].value = " F ";document.calButtons.elements[i++].value = " S ";// blank out non date buttonsfor (i=7; i<startingPos; i++)document.calButtons.elements[i].value = " ";for (i=startingPos; i<days; i++)document.calButtons.elements[i].value = i-startingPos+1;// show focus on today if the calendar is the proper month and yearif (month==nowMonth && year==nowYear+1995)document.calButtons.elements[nowDay+startingPos-1].focus();// blank out rest of non date buttonsfor (i=days; i<49; i++)document.calButtons.elements[i].value = " ";}function leapYear (Year) {if (((Year % 4)==0) && ((Year % 100)!=0) || ((Year % 400)==0))return (1);elsereturn (0);}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 (leapYear (year)==1) days=29;else days=28;}return (days);}// --></SCRIPT><!--第二步:把如下代码加入到<body>区域中--><FORM NAME="calControl"><div align="center">month<SELECT NAME="month"><OPTION>Jan<OPTION>Feb<OPTION>Mar<OPTION>Apr<OPTION>May<OPTION>Jun<OPTION>Jul<OPTION>Aug<OPTION>Sep<OPTION>Oct<OPTION>Nov<OPTION>Dec</SELECT>year<SELECT NAME="year"><OPTION>1995<OPTION>1996<OPTION>1997<OPTION>1998<OPTION>1999<OPTION>2000<OPTION>2001<OPTION>2002</SELECT><INPUT TYPE="button" NAME="button1" VALUE="Create"onClick="displayCalendar(0)"></div></FORM><FORM NAME="calButtons"><div align="center"><INPUT TYPE="button" NAME="but0" value=" "><INPUT TYPE="button" NAME="but1" value=" "><INPUT TYPE="button" NAME="but2" value=" "><INPUT TYPE="button" NAME="but3" value=" "><INPUT TYPE="button" NAME="but4" value=" "><INPUT TYPE="button" NAME="but5" value=" "><INPUT TYPE="button" NAME="but6" value=" "></div><CENTER><INPUT TYPE="button" NAME="but7" value=" "><INPUT TYPE="button" NAME="but8"value=" "><INPUT TYPE="button" NAME="but9" value=" "><INPUT TYPE="button" NAME="but10"value=" "><INPUT TYPE="button" NAME="but11" value=" "><INPUT TYPE="button" NAME="but12"value=" "><INPUT TYPE="button" NAME="but13" value=" "></CENTER><CENTER><INPUT TYPE="button" NAME="but14" value=" "><INPUT TYPE="button" NAME="but15" value=""><INPUT TYPE="button" NAME="but16" value=" "><INPUT TYPE="button" NAME="but17" value=""><INPUT TYPE="button" NAME="but18" value=" "><INPUT TYPE="button" NAME="but19" value=""><INPUT TYPE="button" NAME="but20" value=" "></CENTER><CENTER><INPUT TYPE="button" NAME="but21" value=" "><INPUT TYPE="button" NAME="but22" value=""><INPUT TYPE="button" NAME="but23" value=" "><INPUT TYPE="button" NAME="but24" value=""><INPUT TYPE="button" NAME="but25" value=" "><INPUT TYPE="button" NAME="but26" value=""><INPUT TYPE="button" NAME="but27" value=" "></CENTER><CENTER><INPUT TYPE="button" NAME="but28" value=" "><INPUT TYPE="button" NAME="but29" value=""><INPUT TYPE="button" NAME="but30" value=" "><INPUT TYPE="button" NAME="but31" value=""><INPUT TYPE="button" NAME="but32" value=" "><INPUT TYPE="button" NAME="but33" value=""><INPUT TYPE="button" NAME="but34" value=" "></CENTER><CENTER><INPUT TYPE="button" NAME="but35" value=" "><INPUT TYPE="button" NAME="but36" value=""><INPUT TYPE="button" NAME="but37" value=" "><INPUT TYPE="button" NAME="but38" value=""><INPUT TYPE="button" NAME="but39" value=" "><INPUT TYPE="button" NAME="but40" value=""><INPUT TYPE="button" NAME="but41" value=" "></CENTER><CENTER><INPUT TYPE="button" NAME="but42" value=" "><INPUT TYPE="button" NAME="but43" value=""><INPUT TYPE="button" NAME="but44" value=" "><INPUT TYPE="button" NAME="but45" value=""><INPUT TYPE="button" NAME="but46" value=" "><INPUT TYPE="button" NAME="but47" value=""><INPUT TYPE="button" NAME="but48" value=" "></CENTER></FORM><CENTER><!--第三步:把“ONLOAD="displayCalendar(1)"”加在<body>标记里例如:--><body ONLOAD="displayCalendar(1)">
让你选择自己需要的日历
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。