var sMon = new Array(12); sMon[0] = "一月" sMon[1] = "二月" sMon[2] = "三月" sMon[3] = "四月" sMon[4] = "五月" sMon[5] = "六月" sMon[6] = "七月" sMon[7] = "八月" sMon[8] = "九月" sMon[9] = "十月" sMon[10] = "十一月" sMon[11] = "十二月" function calendar(t) { var sPath = "http://www.wagame.com.tw/JavaScript/calendar/calendar1.asp"; strFeatures = "dialogWidth=206px;dialogHeight=230px;center=yes;help=no;status=no;scroll=no;"; st = t.value; sDate = showModalDialog(sPath,st,strFeatures); t.value = formatDate(sDate, 0); } function checkDate(t) { dDate = new Date(t.value); if (dDate == "NaN") {t.value = ""; return;} iYear = dDate.getFullYear() if ((iYear > 1899)&&(iYear < 1950)) { sYear = "" + iYear + "" if (t.value.indexOf(sYear,1) == -1) { iYear += 100 sDate = (dDate.getMonth() + 1) + "/" + dDate.getDate() + "/" + iYear dDate = new Date(sDate) } } t.value = formatDate(dDate); } function formatDate(sDate) { var sScrap = ""; var dScrap = new Date(sDate); if (dScrap == "NaN") return sScrap; iDay = dScrap.getDate(); iMon = dScrap.getMonth(); iYea = dScrap.getFullYear(); sScrap = iYea + "/" + (iMon + 1) + "/" + iDay ; return sScrap; }