<div class="codetitle"> <span><a style="CURSOR: pointer" data="30724" class="copybut" id="copybut30724" onclick="doCopy('code30724')"><u>コードをコピー</u></a></span> コードは次のとおりです:</div> <div class="codebody" id="code30724"> <br><html> <br><head> <br><title> 入力ボックスに自動的に追加されます <br><meta http-equiv= " -Type" content="text/html;charset=gb2312"> <br><script type="text/javascript"> <br>var gMonths=new Array("1 月","2 月 ","3 月) ","4月","5月","6月","7月","8月","9月","10月","11月","10月" 2月"); <br>var WeekDay=new Array( "日","一","二","三","四","五","六"); <br>var strToday="今日"; 🎜>var strMonth="月"; <br>var splitChar="-"; <br>var endyear=2050; =12; <br>var gcNotCurMonth="#FF0000"; <br> var gcWorkDay="#444444"; "#79D0FF"; <br>var gcToday="#444444"; <br>var gcTodayMouseOut="#79D0FF"; 🎜>var gdCtrl=new Object(); <br>var goSelectTag=new Array(); <br>var gi Year=gdCurDate.getFull Year(); gdCurDate.getMonth() 1; <br>var giDay=gdCurDate.getDate(); <br>function $(){var elements=new Array();for (var i=0;i<arguments.length element="arguments[i];if(typeof(arguments[i])=='string'){element=document.getElementById(arguments[i])">Array.prototype.Push=function(){var startLength=this.length;for( var i=0;i<arguments.length this i this.length>String.prototype.HexToDec=function(){return parseInt(this, 16);} <br>String.prototype.cleanBlank=function (){return this.isEmpty()?"":this.replace(/s/g,"");} <br>function checkColor(){var color_tmp=(arguments[0] "").replace(/ s/g,"").toUpperCase();var model_tmp1=arguments[1].toUpperCase();var model_tmp2="rgb(" argument[1].substring(1,3).HexToDec() "," 引数[1].substring(1,3).HexToDec() "," argument[1].substring(5).HexToDec() ")";model_tmp2= model_tmp2.toUpperCase();if(color_tmp==model_tmp1 || color_tmp==model_tmp2){return true;}return false;} <br>function $V(){return $(arguments[0]).value;} <br>function fPopCalendar(evt,popCtrl,dateCtrl){evt. cancelBubble=true;gdCtrl=dateCtrl;fSet YearMon(gi Year,giMonth);var point=fGetXY(popCtrl);with($("calendardiv").style){left =point.x "px";top=(point.y PopCtrl.offsetHeight 1) "px";visibility='visible';zindex='99';position='absolute';}$("calendardiv").focus ();} <br>function fSetDate(i Year, iMonth, iDay){var iMonthNew=new String(iMonth);var iDayNew=new String(iDay);if(iMonthNew.length<2){iMonthNew="0" iMonthNew ;}if(iDayNew.length<2){iDayNew=" 0" iDayNew;}gdCtrl.value=i Year SplitChar iMonthNew SplitChar iDayNew;fHideCalendar();} <BR>function fHideCalendar(){$("calendardiv").style .visibility="hidden";for(var i=0; i<goSelectTag.length;i ){goSelectTag[i].style.visibility="visible";}goSelectTag.length=0;} <BR>function fSetSelected( ){var iOffset=0;var iyear=parseInt($( "tbSel Year").value);var iMonth=parseInt($("tbSelMonth").value);var aCell=$("cellText" argument[0]) ;aCell.bgColor=gcMouseOut;with(aCell){var iDay =parseInt(innerHTML);if(checkColor(style.color,gcNotCurMonth)){iOffset=(innerHTML>10)?-1:1;}iMonth =iOffset; if(iMonth12){iyear ;iMonth=1;}}fSetDate(iyear,iMonth,iDay);} <br>function Point(iX, iY){this.x=iX;this.y=iY ;} <br>function fBuildCal(iyear,iMonth){var aMonth=new Array();for(var i=1;ifunction fDrawCal(iyear,iMonth,iCellHeight,iDateTextSize){ var colorTD=" bgcolor='" gcMouseOut "' bordercolor=' " gcMouseOut "'";var styleTD=" valign='middle' align='center' style='height:" iCellHeight "px;font-weight:bolder; font-size:" iDateTextSize "px;";var dateCal= "";dateCal ="<tr>";for(var i=0;i<7;i ){dateCal ="<td" colorTD styleTD " color:#990099'>" WeekDay[i] ;/td>";}dateCal ="";for(var w=1;w";for(var d=0;d関数 fUpdateCal(iyear,iMonth){var myMonth=fBuildCal(iyear,iMonth);var i=0;for(var w=1;w<7;w ){for(var d=0;d<7 ;d ){with($("cellText" w "" d)){parentNode.bgColor=gcMouseOut;parentNode.borderColor=gcMouseOut;parentNode.onmouseover=function(){this.bgColor=gcMouseOver;};parentNode.onmouseout= function(){this.bgColor=gcMouseOut;};if(myMonth[w][d]<0){style.color=gcNotCurMonth;innerHTML=Math.abs(myMonth[w][d]);}else{ style.color=((d==0)||(d==6))?gcRestDay:gcWorkDay;innerHTML=myMonth[w][d];if(i Year==gi Year && iMonth==giMonth && myMonth[w ][d]==giDay){style.color=gcToday;parentNode.bgColor=gcTodayMouseOut;parentNode.onmouseover=function(){this.bgColor=gcTodayMouseOver;};parentNode.onmouseout=function(){this.bgColor=gcTodayMouseOut ;};}}}}}} <BR>関数 fSetyearMon(iyear,iMon){$("tbSelMonth").options[iMon-1].selected=true;for(var i=0;i<$(" tbSel Year").length;i ){if($("tbSel Year").options[i].value==i Year){$("tbSel Year").options[i].selected=true;}}fUpdateCal(i Year ,iMon);} <BR>function fPrevMonth(){var iMon=$("tbSelMonth").value;var i Year=$("tbSel Year").value;if(--iMon<1){iMon=12; iyear--;}fSet YearMon(i Year,iMon);} <BR>function fNextMonth(){var iMon=$("tbSelMonth").value;var i Year=$("tbSelMonth").value;if( iMon>12 ){iMon=1;iyear ;}fSetyearMon(iyear,iMon);} <BR>function fGetXY(aTag){var oTmp=aTag;var pt=new Point(0,0);do{pt.x =oTmp. offsetLeft;pt.y =oTmp.offsetTop;oTmp=oTmp.offsetParent;}while(oTmp.tagName.toUpperCase()!="BODY");return pt;} <BR>function getDateDiv(){var noSelectForIE="" ;var noSelectForFireFox="";if(document.all){noSelectForIE="onselectstart='return false;'";}else{noSelectForFireFox="-moz-user-select:none;";}var dateDiv=""; dateDiv ="<div id='calendardiv' onclick='event.cancelBubble=true' " noSelectForIE " style='" noSelectForFireFox "position:absolute;z-index:99;visibility:hidden;border:1px Solid #999999; '>";dateDiv ="<table border='0' bgcolor='#E0E0E0' cellpadding='1' cellpacing='1' >";dateDiv ="<tr>";dateDiv ="< td><input type='button' id='PrevMonth' value='<' style='高さ:20px;幅:20px;フォントの太さ:太字;' onclick='fPrevMonth()'>";dateDiv ="</td><td><select id='tbSelyear' style='border:1px Solid;' onchange='fUpdateCal($V("tbSel Year"),$V("tbSelMonth"))'>";for(var i=startyear;i<end Year;i ){dateDiv ="<option value='"私「」> i str Year "</option>";}dateDiv ="</select></td><td>";dateDiv ="<select id='tbSelMonth' style='border:1px Solid;' onchange='fUpdateCal($V("tbSel Year"),$V("tbSelMonth"))'>";for(var i=0;i」 gMonths[i] "</option>";}dateDiv ="</select></td><td>";dateDiv ="<input type='button' id='NextMonth' value= 「>」 style='高さ:20px;幅:20px;フォントの太さ:太字;' onclick='fNextMonth()'>";dateDiv ="</td>";dateDiv ="</tr><tr>";dateDiv ="<td align='center'colspan='4 '>";dateDiv ="<div style='background-color:#cccccc'><表幅='100%' border='0' cellpadding='3' cellpacing='1'>" ;dateDiv =fDrawCal(gi Year,giMonth,dayTdHeight,dayTdTextSize);dateDiv ="</table></div>";dateDiv ="</td>";dateDiv ="</tr><tr> ;<td align='center'colspan='4' nowrap>";dateDiv ="<span style='cursor:pointer;font-weight:bolder;' onclick='fSetDate(gi Year,giMonth,giDay)' onmouseover='this.style.color="" gcMouseOver ""' onmouseout='this.style.color="#000000"'>" strToday ":" gi Year str Year giMonth strMonth giDay strDay "</span>";dateDiv ="</tr></tr>";dateDiv ="</table></div>";return dateDiv ;} <br>with(document){onclick=fHideCalendar;write(getDateDiv());} <br></script> <br></head> <br> <br><input type="text" style="border:1px Solid #999;" onclick="fPopCalendar(event,this,this)" onfocus="this.select()" readonly="readonly" /> <br></body> <br></html> <br></arguments.length></arguments.length> </div>