한국어
<HTML> <HEAD> <TITLE>유용한 中英文日历网页特效代码-downcodes.com</TITLE> <!--<script 언어="javascript" src="PopupCalendar.js" ></script>-- > <script> //downcodes.com의 추가 정보 function PopupCalendar(InstanceName) { ///전역 태그 this.instanceName=InstanceName; ///속성 this.separator="-" this.oBtnTodayTitle="오늘" this.oBtnCancelTitle="취소" this.weekDaySting=new Array("S","M","T","W","T ","F","S"); this.monthSting=new Array("1월","2월","3월","4월","5월","6월","7월","8월","9월","10월","11월" ,"12월"); this.폭=200; this.currDate=새 날짜(); this.today=새 날짜(); this.startYear=1970; this.endYear=2010; ///Css this.divBorderCss="1px 솔리드 #BCD0DE"; this.tableBorderColor="#CCCCCC" ///방법 this.Init=CalendarInit; this.Fill=캘린더채우기; this.Refresh=캘린더새로고침; this.Restore=CalendarRestore; ///HTMLObject this.oTaget=null; this.oPreviousCell=null; this.sDIVID=InstanceName+"oDiv"; this.sTABLEID=인스턴스이름+"o테이블"; this.sMONTHID=InstanceName+"oMonth"; this.sYEARID=InstanceName+"o연도"; } function CalendarInit() ///패널 만들기 { var sMonth,sYear sMonth=this.currDate.getMonth(); sYear=this.currDate.getYear(); htmlAll="<div id='"+this.sDIVID+"' style='display:none;position:absolute;width:"+this.Width+";border:"+this.divBorderCss+";padding:2px; background- 색상:#FFFFFF'>"; htmlAll+="<div align='center'>"; /// 월 htmloMonth="<select id='"+this.sMONTHID+"' onchange=CalendarMonthChange("+this.instanceName+") style='width:50%'>"; for(i=0;i<12;i++) { htmloMonth+="<option value='"+i+"'>"+this.monthSting[i]+"</option>"; } htmloMonth+="</select>"; /// 연도 htmloYear="<select id='"+this.sYEARID+"' onchange=CalendarYearChange("+this.instanceName+") style='width:50%'>"; for(i=this.startYear;i<=this.endYear;i++) { htmloYear+="<option value='"+i+"'>"+i+"</option>"; } htmloYear+="</select></div>"; /// 일 htmloDayTable="<table id='"+this.sTABLEID+"' width='100%' border=0 cellpadding=0cellspacing=1 bgcolor='"+this.tableBorderColor+"'>"; htmloDayTable+="<tbody bgcolor='#ffffff'style='font-size:13px'>"; for(i=0;i<=6;i++) { if(i==0) htmloDayTable+="<tr bgcolor='#98B8CD'>"; 그렇지 않으면 htmloDayTable+="<tr>"; for(j=0;j<7;j++) { if(i==0) { htmloDayTable+="<td height='20' align='center' valign='middle' style='cursor:hand'>" ; htmloDayTable+=this.weekDaySting[j]+"</td>" } else { htmloDayTable+="<td height='20' align='center' valign='middle' style='cursor:hand'"; htmloDayTable+=" onmouseover=CalendarCellsMsOver("+this.instanceName+")"; htmloDayTable+=" onmouseout=CalendarCellsMsOut("+this.instanceName+")"; htmloDayTable+=" onclick=CalendarCellsClick(this,"+this.instanceName+")>"; htmloDayTable+=" </td>" } } htmloDayTable+="</tr>"; } htmloDayTable+="</tbody></table>"; /// 오늘 버튼 htmloButton="<div align='center' style='padding:3px'>" htmloButton+="<button style='width:40%;border:1px solid #BCD0DE; background-color:#eeeeee ;cursor:hand'" htmloButton+=" onclick=CalendarTodayClick("+this.instanceName+")>"+this.oBtnTodayTitle+"</button> " htmloButton+="<button style='width:40%;border:1px solid # BCD0DE;배경 색상:#eeeeee;cursor:hand'" htmloButton+=" onclick=CalendarCancel("+this.instanceName+")>"+this.oBtnCancelTitle+"</button> " htmloButton+="</div>" // / 모두 htmlAll=htmlAll+htmloMonth+htmloYear+htmloDayTable+htmloButton+"</div>"; document.write(htmlAll); this.Fill(); } function CalendarFill() /// { var sMonth,sYear,sWeekDay,sToday,oTable,currRow,MaxDay,sDaySn,sIndex,rowIndex,cellIndex,oSelectMonth,oSelectYear sMonth=this.currDate.getMonth(); sYear=this.currDate.getYear(); sWeekDay=(새 날짜(sYear,sMonth,1)).getDay(); sToday=this.currDate.getDate(); oTable=document.all[this.sTABLEID]; currRow=oTable.rows[1]; MaxDay=CalendarGetMaxDay(s연도,s월); oSelectMonth=document.all[this.sMONTHID] oSelectMonth.selectedIndex=sMonth; oSelectYear=document.all[this.sYEARID] for(i=0;i<oSelectYear.length;i++) { if(parseInt(oSelectYear.options[i].value)==sYear)oSelectYear.selectedIndex=i; } //// for(sDaySn=1,sIndex=sWeekDay;sIndex<=6;sDaySn++,sIndex++) { if(sDaySn==sToday) { currRow.cells[sIndex].innerHTML="<글꼴 색상=빨간색>< i><b>"+sDaySn+"</b></i></font>"; this.oPreviousCell=currRow.cells[sIndex]; } else { currRow.cells[sIndex].innerHTML=sDaySn; currRow.cells[sIndex].style.color="#666666"; } CalendarCellSetCss(0,currRow.cells[sIndex]); } for(rowIndex=2;rowIndex<=6;rowIndex++) { if(sDaySn>MaxDay)break; currRow=oTable.rows[rowIndex]; for(cellIndex=0;cellIndex<currRow.cells.length;cellIndex++) { if(sDaySn==sToday) { currRow.cells[cellIndex].innerHTML="<font color=red><i><b>"+sDaySn+ "</b></i></font>"; this.oPreviousCell=currRow.cells[cellIndex]; } else { currRow.cells[cellIndex].innerHTML=sDaySn; currRow.cells[cellIndex].style.color="#666666"; } CalendarCellSetCss(0,currRow.cells[cellIndex]); sDaySn++; if(sDaySn>MaxDay)break; } } } function CalendarRestore() /// 데이터 지우기 { var oTable oTable=document.all[this.sTABLEID] for(i=1;i<oTable.rows.length;i++) { for(j=0;j< oTable.rows[i].cells.length;j++) { CalendarCellSetCss(0,oTable.rows[i].cells[j]); oTable.rows[i].cells[j].innerHTML=" "; } } } function CalendarRefresh(newDate) /// { this.currDate=newDate; this.복원(); this.Fill(); } function CalendarCellsMsOver(oInstance) /// 셀 MouseOver { var myCell myCell=event.srcElement; CalendarCellSetCss(0,oInstance.oPreviousCell); if(myCell) { CalendarCellSetCss(1,myCell); oInstance.oPreviousCell=myCell; } } function CalendarCellsMsOut(oInstance) ////// 셀 MouseOut { var myCell myCell=event.srcElement; CalendarCellSetCss(0,myCell); } function CalendarCellsClick(oCell,oInstance) { var sDay,sMonth,sYear,newDate sYear=oInstance.currDate.getFullYear(); sMonth=oInstance.currDate.getMonth(); sDay=oInstance.currDate.getDate(); if(oCell.innerText!=" ") { sDay=parseInt(oCell.innerText); if(sDay!=oInstance.currDate.getDate()) { newDate=new Date(sYear,sMonth,sDay); oInstance.Refresh(newDate); } } sDateString=sYear+oInstance.separator+CalendarDblNum(sMonth+1)+oInstance.separator+CalendarDblNum(sDay); ///sDateString 반환 if(oInstance.oTaget.tagName=="INPUT") { oInstance.oTaget.value=sDateString; } document.all[oInstance.sDIVID].style.display="none"; } function CalendarYearChange(oInstance) /// 연도 변경 { var sDay,sMonth,sYear,newDate sDay=oInstance.currDate.getDate(); sMonth=oInstance.currDate.getMonth(); sYear=document.all[oInstance.sYEARID].value newDate=new Date(sYear,sMonth,sDay); oInstance.Refresh(newDate); } function CalendarMonthChange(oInstance) /// 월 변경 { var sDay,sMonth,sYear,newDate sDay=oInstance.currDate.getDate(); sMonth=document.all[oInstance.sMONTHID].value sYear=oInstance.currDate.getYear(); newDate=새 날짜(s년,s월,s일); oInstance.Refresh(newDate); } function CalendarTodayClick(oInstance) /// "오늘" 버튼 Change { oInstance.Refresh(new Date()); } function getDateString(oInputSrc,oInstance) { if(oInputSrc&&oInstance) { CalendarDiv=document.all[oInstance.sDIVID]; oInstance.oTaget=oInputSrc; CalendarDiv.style.pixelLeft=CalendargetPos(oInputSrc,"왼쪽"); CalendarDiv.style.pixelTop=CalendargetPos(oInputSrc,"Top")+oInputSrc.offsetHeight; CalendarDiv.style.display=(CalendarDiv.style.display=="없음")?"":"없음"; } } function CalendarCellSetCss(sMode,oCell) /// 셀 Css 설정 { // sMode // 0: OnMouserOut 1: OnMouseOver if(sMode) { oCell.style.border="1px solid #5589AA"; oCell.style.BackgroundColor="#BCD0DE"; } else { oCell.style.border="1px 솔리드 #FFFFFF"; oCell.style.BackgroundColor="#FFFFFF"; } } function CalendarGetMaxDay(nowYear,nowMonth) /// 이번 달의 MaxDay 가져오기 { var nextMonth,nextYear,currDate,nextDate,theMaxDay nextMonth=nowMonth+1; if(nextMonth>11) { nextYear=nowYear+1; 다음월=0; } else { nextYear=nowYear; } currDate=new Date(nowYear,nowMonth,1); nextDate=새 날짜(nextYear,nextMonth,1); theMaxDay=(nextDate-currDate)/(24*60*60*1000); MaxDay를 반환합니다. } function CalendargetPos(el,ePro) /// 절대 위치 가져오기 { var ePos=0; while(el!=null) { ePos+=el["offset"+ePro]; el=el.offsetParent; } ePos를 반환합니다. } function CalendarDblNum(num) { if(num<10) return "0"+num; 그렇지 않으면 숫자를 반환합니다. } function CalendarCancel(oInstance) ///취소 { CalendarDiv=document.all[oInstance.sDIVID]; CalendarDiv.style.display="없음"; } </script> </head> <BODY > <script > var oCalendarEn=new PopupCalendar("oCalendarEn"); //初始化控件时,请给流实例name称如:oCalendarEn oCalendarEn.Init(); var oCalendarChs=new PopupCalendar("oCalendarChs"); //初始化控件时,请给实例name称:oCalendarChs oCalendarChs.weekDaySting=new Array("日","一","二","三","四","五","六"); oCalendarChs.monthSting=new Array("일월","이월","삼월","사월","오월","六月","七月","八月","九月","十月","十一月","十two月"); oCalendarChs.oBtnTodayTitle="今천"; oCalendarChs.oBtnCancelTitle="取消"; oCalendarChs.Init(); </script> <br><br><br><br> <input readonly type="text" name="dd" id="aa" onClick="getDateString(this,oCalendarEn)" value="영어 버전" > <br><br><br><br> <input readonly type="text" name="dd" id="aa" onClick="getDateString(this,oCalendarChs)" value="中文界면版"> < /BODY> </HTML>