실행 결과는 다음과 같습니다. 코드 복사 코드는 다음과 같습니다. <br>함수 choose_date_czw(date_id,objtd){<br>if(date_id=="choose_date_czw_close"){<br> document.getElementByIdx_x_x("choose_date_czw_id").style.display="none";<br> return;<br>}<br>if(objtd!=undefine){<br> if(objtd=="choose_date_czw_empty"){ <br> document.getElementByIdx_x_x(date_id).value="";<br> }else{<br> var year1 = document.getElementByIdx_x_x("choose_date_czw_year").value;<br> var Month1 = document.getElementB yIdx_x_x("choose_date_czw_month ").value;<br> document.getElementByIdx_x_x(date_id).value=year1 "-" Month1 "-" objtd.innerHTML;<br> }<br> document.getElementByIdx_x_x("choose_date_czw_id").style.display=" none";<br> return;<br>}<br>var nstr=new Date(); //当前<br>if(document.getElementByIdx_x_x("choose_date_czw_year")!=null){<br> var year = document.getElementByIdx_x_x("choose_date_czw_year").value;<br> var Month = document.getElementByIdx_x_x("choose_ 날짜_czw_월 ").value;<br> var str=연도 "/" 월 "/1";<br> nstr=new 날짜(str); //当前<br>}<br>var ynow=nstr.getFullYear(); //연령<br>var mnow=nstr.getMonth(); //월<br>var dnow=nstr.getDate(); //현재 날짜<br>var n1str=new Date(ynow,mnow,1); //当月第一天<br>var firstday=n1str.getDay(); //当月第一하늘별期几<br>function is_leap(year) {<br> return (year0==0 ? res=(year@0==0 ? 1 : 0) : res=(year%4== 0 ? 1: 0));<br>}<br>var dstr="<select id="choose_date_czw_year" onchange="choose_date_czw('" date_id "')">";<br>for(var y =1901;y<2050;y ){<BR> if(y==ynow){<BR> dstr ="<옵션 값='" y "' 선택됨>" y "</option>"<br> }else{<br> dstr ="<옵션 값='" y "'>" y "</option>"<br> }<br>}<br>dstr ="</select> <select id="choose_date_czw_month" onchange="choose_date_czw('" date_id "')">" ;<br>for(var m=1;m<13;m ){<br> if(parseInt(mnow 1)==m){<br> dstr ="<option value='" m "' selected> ;" m "</option>"<br> }else{<br> dstr ="<옵션 값='" m "'>" m "</option>"<br> }<br>}<br>dstr ="</select> <span style='cursor:pointer;' onclick="choose_date_czw('choose_date_czw_close')">关闭</span>|<span style='cursor:pointer;' onclick="choose_date_czw('" date_id "','choose_date_czw_empty')">清空</span>";<br>//一三五七八十腊(十two月),三十一日永不差;4六九冬(十一月) 3十日,唯有 2月 2十八(闰年 2十九).<br>var m_days = new Array(31,28 is_leap(ynow),31,30, 31,30,31,31,30,31,30,31);<br>var tr_str=Math.ceil((m_days[mnow] firstday)/7);<br>dstr ="<table border=' 0' cellpadding='5' cellpacing='0'><tr><td>日</td><td>一</td><td>이</td>< td>삼<td>f4</td> <td>五</td> <td>六</td>";<br>var dqdate =새 날짜(); //当前<br>for(i=0;i<tr_str tr> dstr ="<tr>";<br> for(k=0;k< ;7;k ) { //内层for语句- td标签<br> idx=i*7 k; //表格单元的自然序号<br> date_str=idx-firstday 1; //计算日期<br> if(date_str<=0 || date_str>m_days[mnow]){<br> dstr ="<td> </td>";<br> }else{<br> if (ynow==dqdate.getFullYear() && mnow==dqdate.getMonth() && dqdate.getDate()==date_str){<br> dstr ="<td onmouseover="this.style.BackgroundColor='#6FF '" onmouseout="this.style.BackgroundColor='#fff'" onclick="choose_date_czw('" date_id "',this)" style='cursor:pointer; background-color:#6FF;'>" date_str "</td>";<br> }else{<br> dstr ="<td onmouseover="this.style.BackgroundColor='#6FF'" onmouseout="this.style.BackgroundColor='#fff'" onclick="choose_date_czw('" date_id "', 이)" 스타일='커서:포인터;'>" date_str "</td>";<br> }<br> }<br> }<br> dstr ="</tr>";<br>}<br>dstr ="</table>" ;<br>if(document.getElementByIdx_x_x("choose_date_czw_id")==null){<br>var obj = document.getElementByIdx_x_x(date_id);<br>var odiv = document_createElement_x_x("div");<br>odiv. id="choose_date_czw_id";<br>odiv.innerHTML=dstr;<br>odiv.style.position="absolute";<br>odiv.style.border="1px #0CF solid";<br>odiv.style .fontSize="12px";<br>odiv.style.zIndex=99999;<br>odiv.style.top=obj.offsetTop obj.offsetHeight "px";<br>odiv.style.left=obj.offsetLeft " px";<br>document.body.a(odiv);<br>}else{<br> document.getElementByIdx_x_x("choose_date_czw_id").style.display="block";<br> document.getElementByIdx_x_x("choose_date_czw_id ").innerHTML=dstr;<br>}<br>}<br>