<SCRIPT language="JavaScript"> <!-- Now = new Date(); NowDay = Now.getDate(); NowMonth = Now.getMonth(); NowYear = Now.getYear();
function DaysInMonth(WhichMonth, WhichYear) { var DaysInMonth = 31;
if (WhichMonth == "4월" || WhichMonth == "6월" || WhichMonth == "9월" || WhichMonth == "11월") DaysInMonth = 30;
if (WhichMonth == "2월" && (WhichYear/4) != Math.floor(WhichYear/4)) DaysInMonth = 28;
if (WhichMonth == "2월" && (WhichYear/4) == Math.floor(WhichYear/4)) DaysInMonth = 29;
return DaysInMonth; }
function ReOptionDays(Which) { DaysObject = eval("document.Form1." + Which + "Day"); MonthObject = eval("document.Form1." + Which + "Month"); YearObject = eval("document.Form1." + Which + "Year");
Month = MonthObject[MonthObject.selectedIndex].text; Year = YearObject[YearObject.selectedIndex].text;
DaysForThisSelection = DaysInMonth(Month, Year);
CurrentDaysInSelection = DaysObject.length;
if (CurrentDaysInSelection > DaysForThisSelection) { for (i=0; i<(CurrentDaysInSelection-DaysForThisSelection); i++) { DaysObject.options[DaysObject.options.length - 1] = null } }
if (DaysForThisSelection > CurrentDaysInSelection) { for (i=0; i<(DaysForThisSelection-CurrentDaysInSelection); i++) { NewOption = new Option(DaysObject.options.length + 1); DaysObject.add(NewOption); } }
if (DaysObject.selectedIndex < 0) DaysObject.selectedIndex == 0; }
function Today_getting(Which) {
DaysObject = eval("document.Form1." + Which + "Day"); MonthObject = eval("document.Form1." + Which + "Month"); YearObject = eval("document.Form1." + Which + "Year");
YearObject[0].selected = true; MonthObject[NowMonth].selected = true;
ReOptionDays(Which);
DaysObject[NowDay-1].selected = true; }
function WriteYearOptions(YearsAhead) { line = "";
for (i=0; i<YearsAhead; i++) { line += "<OPTION>"; line += NowYear + i; }
return line; } //--> </SCRIPT>
<BODY onload="Today_getting('FirstSelect');">
<!--폼 환경설정 시작--> <FORM name="Form1"> <SELECT name="FirstSelectYear" onchange="ReOptionDays('FirstSelect')"> <SCRIPT language="JavaScript"> <!-- document.write(WriteYearOptions(50)); --> </SCRIPT> </SELECT>년 <SELECT name="FirstSelectMonth" onchange="ReOptionDays('FirstSelect')"> <OPTION>1월 <OPTION>2월 <OPTION>3월 <OPTION>4월 <OPTION>5월 <OPTION>6월 <OPTION>7월 <OPTION>8월 <OPTION>9월 <OPTION>10월 <OPTION>11월 <OPTION>12월 </SELECT> <SELECT name="FirstSelectDay"> <OPTION>1일 <OPTION>2일 <OPTION>3일 <OPTION>4일 <OPTION>5일 <OPTION>6일 <OPTION>7일 <OPTION>8일 <OPTION>9일 <OPTION>10일 <OPTION>11일 <OPTION>12일 <OPTION>13일 <OPTION>14일 <OPTION>15일 <OPTION>16일 <OPTION>17일 <OPTION>18일 <OPTION>19일 <OPTION>20일 <OPTION>21일 <OPTION>22일 <OPTION>23일 <OPTION>24일 <OPTION>25일 <OPTION>26일 <OPTION>27일 <OPTION>28일 <OPTION>29일 <OPTION>30일 <OPTION>31일 </SELECT> </FORM> <!--폼 환결 설정 끝-->
|