日历代码 2022-07-15 80酷酷网 80kuku.com 日历<html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><meta name="GENERATOR" content="Microsoft FrontPage 4.0"><meta name="ProgId" content="FrontPage.Editor.Document"><title>New Page 1</title></head><body><p><object classid="clsid:8E27C92B-1264-101C-8A2F-040224009C02" id="Calendar1" width="288" height="192"> <param name="_Version" value="524288"> <param name="_ExtentX" value="7620"> <param name="_ExtentY" value="5080"> <param name="_StockProps" value="1"> <param name="BackColor" value="-2147483633"> <param name="Year" value="2005"> <param name="Month" value="8"> <param name="Day" value="11"> <param name="DayLength" value="0"> <param name="MonthLength" value="0"> <param name="DayFontColor" value="0"> <param name="FirstDay" value="1"> <param name="GridCellEffect" value="1"> <param name="GridFontColor" value="10485760"> <param name="GridLinesColor" value="-2147483632"> <param name="ShowDateSelectors" value="-1"> <param name="ShowDays" value="-1"> <param name="ShowHorizontalGrid" value="-1"> <param name="ShowTitle" value="-1"> <param name="ShowVerticalGrid" value="-1"> <param name="TitleFontColor" value="10485760"> <param name="ValueIsNull" value="0"></object></p></body></html><!--author:hezhiwu5163.com--><table border="1" bordercolor="red"><colgroup><col /><col /><col /><col /><col /><col valign="top" id="cap" <td>日</td> <td>一</td> <td>二</td> <td>三</td> <td>四</td> <td>五</td> <td>六</td></tr><script language="javascript">var objdate=new Date();var tempdate=new Date();tempdate.setDate(1);var day=tempdate.getDay();var maxday=new Date(objdate.getYear(), objdate.getMonth()+1, 0).getDate();cap.innerText=objdate.getYear()+"年"+(objdate.getMonth()+1)+"月"+objdate.getDate()+"日";var d=1,dd=1;for(var i=0;i<6;i++){document.write("<tr>")for(var j=1;j<8;j++){if(d<=day || dd>maxday){document.write("<td> </td>")};else if(dd==Number(objdate.getDate())){document.write("<td bgcolor='silver'>"+dd+"</td>");dd++}else{document.write("<td>"+dd+"</td>");dd++}d++}document.write("</tr>")}</script></table><scripttype="text/javascript">String.prototype.Format = function(){ var tmpStr = this; var iLen =arguments.length; for(var i=0;i<iLen;i++){ tmpStr =tmpStr.replace(new RegExp("\\{" + i + "\\}", "g"), arguments[i]); }return tmpStr;}Calendar = { //region Property today : new Date(), year : 2005, month :8, date : 21, curPosX : 0, curPosY : 0, curCapture : null, curDay :null, //endregion //region Method display : function(o, e, d){with(Calendar){ o = typeof(o) == "object" ? o :document.getElementById(o); if(window.event){ curPosX =document.body.scrollLeft + event.x; curPosY = document.body.scrollTop +event.y; } else{ curPosX = e.pageX; curPosY = e.pageY; } if(o.value =="" && d) o.value = d;with(document.getElementById("Calendar__")){ if(o != curCapture) {curCapture = o; if(style.display == "block"){ style.left = curPosX +"px"; style.top = curPosY + "px"; } else load(); } else{ if(style.display == "block") style.display = "none"; else load(); } } }}, load : function(){ with(Calendar){ curDay =loadDate(curCapture.value); with(curDay){ year = getFullYear(); month =getMonth() + 1; date = getDate(); } init(); } }, init : function(){with(Calendar){ with(new Date(year, month-1, date)){ year =getFullYear(); month = getMonth() + 1; date = getDate(); setDate(1);var first = getDay(); setMonth(getMonth()+1, 0) paint(first,getDate()); } } }, paint : function(first, last){ var calendar =document.getElementById("Calendar__"); var grid =document.getElementById("dataGrid__"); var i, l; l = Math.ceil((first +last)/7); if(!document.all){ calendar.style.height = (41 + 19 *Math.ceil((first + last)/7)) + "px"; } grid.innerHTML = new Array(l*7 +1).join("<li><a></a></li>"); with(Calendar){var strDate = "{0}-{1}".Format(year, month); var isTodayMonth = ((year== today.getFullYear()) && (month == today.getMonth() + 1));var isCurdayMonth = ((year == curDay.getFullYear()) && (month== curDay.getMonth() + 1)); var todayDate = today.getDate();for(i=0;i<last;i++){ grid.childNodes[first + i].innerHTML = '<ahref="{2}-{1}"{0} >{1}</a>'.Format(((i+1) == todayDate &&isTodayMonth) ? ' class="today"' : isCurdayMonth && (i+1) ==curDay.getDate()?' class="curDay"':'', i + 1, strDate); }document.getElementById("dateText__").innerHTML = '<a href="' +(year-1) + '年" title="上一年"><<</a> <a href="上一月" title="上一月"><</a>' + year + " - " + month + ' <a href="下一月" title="下一月">></a><a href="' + (year+1) + '年" title="下一年">>></a>'; with(calendar){ style.left =Calendar.curPosX + "px"; style.top = Calendar.curPosY + "px";style.display = "block"; } } }, turn : function(num){ Calendar.month +=num; Calendar.date = 1; Calendar.init(); }, setValue : function(val){with(Calendar){ curCapture.value = "{0}-{1}-{2}".Format(year, month,val); document.getElementById("Calendar__").style.display = "none"; }}, loadDate : function(op, formatString){ formatString = formatString|| "ymd"; var m, year, month, day; switch(formatString){ case "ymd" : m= op.match(newRegExp("^((\\d{4})|(\\d{2}))([-./])(\\d{1,2})\\4(\\d{1,2})$")); if(m ==null ) return new Date(); day = m[6]; month = m[5]*1; year =(m[2].length == 4) ? m[2] : GetFullYear(parseInt(m[3], 10)); break;case "dmy" : m = op.match(newRegExp("^(\\d{1,2})([-./])(\\d{1,2})\\2((\\d{4})|(\\d{2}))$")); if(m ==null ) return new Date(); day = m[1]; month = m[3]*1; year =(m[5].length == 4) ? m[5] : GetFullYear(parseInt(m[6], 10)); break;default : break; } if(!parseInt(month)) return new Date(); month =month==0 ?12:month; var date = new Date(year, month-1, day); return(typeof(date) == "object" && year == date.getFullYear()&& month == (date.getMonth()+1) && day ==date.getDate())?date:new Date(); function GetFullYear(y){return((y<30 ? "20" : "19") + y)|0;} }, toString : function(){return["Calendar v1.0", "author:我佛山人", "email:wfsrmsn.com","version:1.0"].join("\n");} //endregion}var __calendar_html = "<style>"; __calendar_html += "#Calendar__{background-color:#eeeeee;width:157!important;width:154px;position:absolute;display:none}";__calendar_html += "#Calendar__ul{list-style-type:none;margin-left:-38px !important;margin:0 0 0-30px;}"; __calendar_html += "#Calendar__ ulli{display:block;width:20px;margin:1px;background-color:#fff;text-align:center;float:left;font:11pxTahoma}"; __calendar_html += "#Calendar__ ul lia{height:18px;display:block;background-color:#fff;line-height:18px;text-decoration:none;color:#333}";__calendar_html += "#Calendar__ ul lia:hover{background:#336699;color:#FFF}"; __calendar_html +="#Calendar__ #dateText__{font:12px Tahoma;text-align:center}";__calendar_html += "#Calendar__ #dateText__ a{font:10pxTahoma;text-decoration:none}"; __calendar_html += "#Calendar__ #head__li a{font:bold 12px Tahoma}"; __calendar_html += "#Calendar__#dataGrid__{}"; __calendar_html += "#Calendar__ #dataGrid__ lia:hover{background:#dedede url(/plus/calendar/check.gif) right bottomno-repeat;color:red}"; __calendar_html += "#Calendar__ #dataGrid__.today{background:url(/plus/calendar/today.gif) centerno-repeat;color:blue;}"; __calendar_html += "#Calendar__ #dataGrid__.curDay{background:#dedede url(/plus/calendar/check.gif) right bottomno-repeat;color:blue;}"; __calendar_html += "</style>";__calendar_html += "<div id=\"Calendar__\">"; __calendar_html +="<div id=\"dateText__\"></div>"; __calendar_html += "<ulid=\"head__\" onclick=\"return false\">"; __calendar_html +="<li><a href=\"#\">日</a></li><li><ahref=\"#\">一</a></li><li><ahref=\"#\">二</a></li><li><ahref=\"#\">三</a></li><li><ahref=\"#\">四</a></li><li><ahref=\"#\">五</a></li><li><ahref=\"#\">六</a></li>"; __calendar_html +="</ul>"; __calendar_html += "<ulid=\"dataGrid__\"></ul>"; __calendar_html += "</div>";document.write(__calendar_html);</script><input type="text" id="demo"><img src="http://file.wbgxw.com/UpLoadPic/2007-4/20074115223989.gif"align="absmiddle" ><input type="text" id="demo1"><img src="http://file.wbgxw.com/UpLoadPic/2007-4/20074115223989.gif"align="absmiddle" ><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><HTML><HEAD><TITLE> DropListDown </TITLE><META NAME="Generator" CONTENT="EditPlus"><META NAME="Author" CONTENT=""><META NAME="Keywords" CONTENT=""><META NAME="Description" CONTENT=""></HEAD><SCRIPT LANGUAGE=""><!--/* --------------------DropListCss.js------------------------ */var DropList_imgPath = "//www.513w.com/pk/dlImg/"/*滚动条 */ var SCROLL_BODY_COLOR = "#ffffff";/*滚动条边框 */ var SCROLL_BORDER_COLOR = "#AAAAAA";document.write("<style>");document.write("body {");document.write("SCROLLBAR-FACE-COLOR: " + SCROLL_BODY_COLOR + ";"); /* 滚动条凸出部分的颜色 */document.write("SCROLLBAR-HIGHLIGHT-COLOR: " + SCROLL_BODY_COLOR + ";"); /* 滚动条空白部分的颜色 */document.write("SCROLLBAR-SHADOW-COLOR: " + SCROLL_BODY_COLOR + ";"); /* 立体滚动条阴影的颜色 */document.write("SCROLLBAR-3DLIGHT-COLOR: " + SCROLL_BORDER_COLOR + ";"); /* 滚动条亮边的颜色 */document.write("SCROLLBAR-ARROW-COLOR: " + SCROLL_BORDER_COLOR + ";"); /* 上下按钮上三角箭头的颜色 */document.write("SCROLLBAR-TRACK-COLOR: " + SCROLL_BODY_COLOR + ";"); /* 滚动条的背景颜色 */document.write("SCROLLBAR-DARKSHADOW-COLOR: " + SCROLL_BORDER_COLOR + ";"); /* 滚动条强阴影的颜色 */document.write("SCROLLBAR-BASE-COLOR: " + SCROLL_BODY_COLOR + ";"); /* 滚动条的基本颜色 */document.write("}");document.write(".DropList {");document.write("border-top:1px solid #9C9A9C;");document.write("border-left:1px solid #9C9A9C;");document.write("border-bottom:1px solid #9C9A9C;");document.write("border-right:0px;");document.write("width:133px;");document.write("height:20px;");document.write("font-family:verdana;font-size:12px;");document.write("padding-top:2px;");document.write("}");document.write(".DropListDiv {");document.write("position:absolute;");document.write("border-top:1px solid #9C9A9C;");document.write("border-left:1px solid #9C9A9C;");document.write("border-bottom:1px solid #9C9A9C;");document.write("border-right:1px solid #9C9A9C;");document.write("background-color: #ffffff;");document.write("font-family:verdana;font-size:12px;");document.write("overflow:auto;");document.write("}");document.write(".DropListData {");document.write("padding-left:5px;");document.write("height:18px;");document.write("font-family:verdana;font-size:12px;");document.write("}");document.write(".DropListData_Over {");document.write("padding-left:5px;");document.write("height:18px;");document.write("background-color:#EFF7FF;");document.write("font-family:verdana;font-size:12px;");document.write("}");document.write(".DropListData_Selected {");document.write("padding-left:5px;");document.write("height:18px;");document.write("background-color:#BDC3D6;");document.write("font-family:verdana;font-size:12px;");document.write("}");document.write(".DropDateCell {");document.write("text-align:center;");document.write("vertical-align:center;");document.write("font-size:9px;font-family:verdana;");document.write("cursor:default;");document.write("color:#333333;");document.write("background-color:#eeeeee;");document.write("border:1px solid #eeeeee;");document.write("padding-top:1px;padding-bottom:1px;");document.write("width:14%;height:16px;");document.write("}");document.write(".DropDateCell_over {");document.write("text-align:center;");document.write("font-size:9px;font-family:verdana;");document.write("cursor:default;");document.write("background-color:#ffffff !important;");document.write("border:1px solid #eeeeee;");document.write("padding-top:1px;padding-bottom:1px;");document.write("width:14%;height:15px;");document.write("}");document.write(".DropDateCell_today {");document.write("text-align:center;");document.write("font-size:9px;font-family:verdana;");document.write("cursor:default;");document.write("background-color:#ffeeee !important;");document.write("border:1px solid #ffffff;");document.write("padding-top:1px;padding-bottom:1px;");document.write("width:14%;height:15px;");document.write("}");document.write(".DropDateCellTitle {");document.write("text-align:center;");document.write("font-size:12px;font-family:verdana;");document.write("cursor:default;");document.write("background-color:#eeeeee;");document.write("border:1px solid #eeeeee;");document.write("padding-top:3px;padding-bottom:1px;");document.write("width:14%;");document.write("}");document.write(".DropDateTitle {");document.write("text-align:center;");document.write("font-size:12px;font-family:verdana;");document.write("cursor:default;");document.write("background-color:#dddddd;");document.write("padding-top:1px;padding-bottom:1px;");document.write("width:14%;height:20px;");document.write("}");document.write("a.DropListTextLink:link,a.DropListTextLink:hover,a.DropListTextLink:visited {");document.write("cursor:default;");document.write("text-decoration:none !important;");document.write("color:#999999;");document.write("}");document.write(".DropDateInput {");document.write("border:1px solid #999999;");document.write("height:14px;");document.write("padding:0px;");document.write("font-size:9px;font-family:verdana;");document.write("color:#666666;");document.write("}");document.write("</style>");/*------------------DropListModel.js----------------------*/var global_removers=[]; /*objects need to release , something like event*/var global_droplist={}; /*save all droplistdown object in this page*/DropList = function(id){ this.id=id; this.editable=false; this.datas=[]; this.labels=[]; this.rowCount=5; this.width=133; this.isopen=0; this.dropDate=false; this.serveryear=null; this.servermonth=null; this.serverday=null; this.serverweekday=null; this.dropDateFormat = "yyyy-mm-dd"; this.method="dropListGetValue"; this.dropDivName="__DropListDiv"; this.addItem = function(data,label){ this.datas.push(data); this.labels.push(label); } this.removeItem = function(index){ this.datas.splice(index,1); this.labels.splce(index,1); } this.getItemAt = function(index){ return { data:this.datas[index], label:this.labels[index] } } this.getItems = function(){ return { datas:this.datas, labels:this.labels } } this.getDatas = function(){ return this.getItems().datas; } this.getLabels = function(){ return this.getItems().labels; } this.refresh = function(){ var obj=document.getElementById(this.id); if (!obj){ obj=document.getElementsByName(this.id)[0]; } /*the input object does not exist*/ if (obj==null){ return; } obj.className = "DropList"; obj.style.width=this.width+"px"; obj.parentNode.style.whiteSpace="nowrap"; var img=document.createElement("IMG"); if (this.dropDate){ img.src=DropList_imgPath+"dropBtnDate.gif"; }else{ img.src=DropList_imgPath+"dropBtn.gif"; } img.style.cursor="default"; if (img.attachEvent){ img.attachEvent("onclick",imgClick); /*imgClick DropList button method,find it in droplistEvent.js*/ document.attachEvent("onclick",closeAll); }else{ img.addEventListener("click",imgClick,true); document.addEventListener("click",closeAll,true); } if (document.all){ img.style.verticalAlign="-2"; }else{ img.style.verticalAlign="-5"; } obj.parentNode.insertBefore(img,obj.nextSibling); if (!this.editable){ obj.readOnly=true; obj.style.cursor="default"; } /*if the drop list is a date drop , make the drop layer width more then 140 pixel*/ if (this.dropdate && this.width<140){ this.width=140; } /*if the droplist is editable , to catch the value user typed in*/ if (this.editable){ if (obj.attachEvent){ obj.attachEvent("onkeyup",setKeyValue); }else{ obj.addEventListener("keyup",setKeyValue,true); } global_removers.push(new Remover(obj,"keyup",setKeyValue)); } function setKeyValue(){ obj.setAttribute("data",obj.value); } /*save object who need release*/ global_removers.push(new Remover(img,"click",imgClick)); global_removers.push(new Remover(document,"click",imgClick)); /*save droplistdown in pages,that event can find them*/ global_droplist[this.id]=this; } this.open = function(){var dlv = new DropListView(this); delete dlv; } this.close =function(){ document.getElementById(this.dropDivName).innerHTML="";document.getElementById(this.dropDivName).style.display="none"; }}/*remove Object model*/Remover = function(obj,ev,f){ return{ object:obj, event:ev, func:f }}/*------------------DropListView.js----------------------*/DropListView = function(droplist){ if(document.getElementById(droplist.dropDivName)==null){ var div =document.createElement("DIV");div.setAttribute("id",droplist.dropDivName); div.style.top="-1200px";div.style.left="-1200px"; document.body.appendChild(div); }else{ vardiv=document.getElementById(droplist.dropDivName);div.style.display="block"; } div.style.width=(droplist.width+17)+"px";if (droplist.dropDate && droplist.width<161){div.style.width="170px"; } div.className="DropListDiv"; /*IE bug , ifprevious droplist has scroll , the next droplist will have too. thecode will show scroller in right way.*/ div.style.overflow = "hidden";div.style.overflow = "auto"; /*------------------------------------*/var tmpLen = Math.min(droplist.datas.length,droplist.rowCount); if(tmpLen == 0){ tmpLen = 1; } div.style.height=((tmpLen*18)+2)+"px"; if(droplist.dropDate){document.all?div.style.height="160px":div.style.height="162px"; }this.head = function(){ if (droplist.dropDate){/*Normal drop list downobject*/ return "<Table cellpadding=\"0\" cellspacing=\"2\" border=0width=\"100%\"><tr><td class=\"DropDateCellTitle\" }else{return "<Table cellpadding=\"0\" cellspacing=\"0\" border=0width=\"100%\">"; } } this.body = function(){ var tmpCode=""; if(droplist.dropDate){/*Normal drop list down object*/ for (vari=0;i<5;i++){ tmpCode += "<tr>"; tmpCode += "<tdclass=\"DropDateCell\"onmouseover=\"this.className='DropDateCell_over'\"onmouseout=\"this.className='DropDateCell'\" += "<td class=\"DropDateCell\"onmouseover=\"this.className='DropDateCell_over'\"onmouseout=\"this.className='DropDateCell'\"onclick=\"getDropListDate(this,'"+droplist.id+"')\"></td>";tmpCode += "<td class=\"DropDateCell\"onmouseover=\"this.className='DropDateCell_over'\"onmouseout=\"this.className='DropDateCell'\"onclick=\"getDropListDate(this,'"+droplist.id+"')\"></td>";tmpCode += "<td class=\"DropDateCell\"onmouseover=\"this.className='DropDateCell_over'\"onmouseout=\"this.className='DropDateCell'\"onclick=\"getDropListDate(this,'"+droplist.id+"')\"></td>";tmpCode += "<td class=\"DropDateCell\"onmouseover=\"this.className='DropDateCell_over'\"onmouseout=\"this.className='DropDateCell'\"onclick=\"getDropListDate(this,'"+droplist.id+"')\"></td>";tmpCode += "<td class=\"DropDateCell\"onmouseover=\"this.className='DropDateCell_over'\"onmouseout=\"this.className='DropDateCell'\"onclick=\"getDropListDate(this,'"+droplist.id+"')\"></td>";tmpCode += "<td class=\"DropDateCell\"onmouseover=\"this.className='DropDateCell_over'\"onmouseout=\"this.className='DropDateCell'\" += "</tr>"; } tmpCode += "<tr>"; tmpCode += "<tdclass=\"DropDateCell\"onmouseover=\"this.className='DropDateCell_over'\"onmouseout=\"this.className='DropDateCell'\" += "<td class=\"DropDateCell\"onmouseover=\"this.className='DropDateCell_over'\"onmouseout=\"this.className='DropDateCell'\"onclick=\"getDropListDate(this,'"+droplist.id+"')\"></td>";tmpCode += "<td id=\"__adders\" class=\"DropDateCell\"colspan=\"5\">"; /*previousYear*/ tmpCode += "<a href=\"#\"class=\"DropListTextLink\"onclick=\"dropPrevYear(this.nextSibling,'"+droplist.id+"');returnfalse;\">◀</a>"; /*YearInput*/ tmpCode += "<inputtype=\"text\" class=\"DropDateInput\" maxlength=4 || event.keyCode==13){this.blur()}\"onmouseover=\"this.focus();\"/>"; /*nextYear*/ tmpCode += "<ahref=\"#\" class=\"DropListTextLink\"onclick=\"dropNextYear(this.previousSibling,'"+droplist.id+"');returnfalse;\">▶</a><imgsrc=\""+DropList_imgPath+"year.gif\" "; /*previousMonth*/ tmpCode +="<a href=\"#\" class=\"DropListTextLink\"onclick=\"dropPrevMonth(this.previousSibling.previousSibling.previousSibling.previousSibling,'"+droplist.id+"');returnfalse;\">◀</a>"; /*MonthInput*/ tmpCode +="<input type=\"text\" class=\"DropDateInput\" maxlength=2 || event.keyCode==13){this.blur()}\"onmouseover=\"this.focus();this.select() \"/>"; /*nextMonth*/tmpCode += "<a href=\"#\" class=\"DropListTextLink\"onclick=\"dropNextMonth(this.previousSibling.previousSibling.previousSibling.previousSibling.previousSibling.previousSibling,'"+droplist.id+"');returnfalse;\">▶</a><imgsrc=\""+DropList_imgPath+"month.gif\" tmpCode += "</td>"; tmpCode+= "</tr>"; tmpCode += "<tr>"; tmpCode += "<tdid=\"__adders\" class=\"DropDateTitle\" colspan=\"7\"></td>";tmpCode += "</tr>"; }else{ for (vari=0;i<droplist.datas.length;i++){ tmpCode+="<tr><tdclass=\"DropListData\"onmouseover=\"this.className='DropListData_Over'\"onmouseout=\"this.className='DropListData'\" index=\""+i+"\"onclick=\""+droplist.method+"('"+droplist.id+"',"+i+")\">"+droplist.labels[i]+"</td></tr>";} if (tmpCode==""){ tmpCode="<tr><td class=\"DropListData\"onmouseover=\"this.className='DropListData_Over'\"onmouseout=\"this.className='DropListData'\"align=\"center\">--------</td></tr>" } } return tmpCode;} this.foot = function(){ return "</table>"; } div.innerHTML =this.head()+this.body()+this.foot(); if (droplist.dropDate){dropDateFill(droplist,droplist.serveryear,droplist.servermonth,droplist.serverday,droplist.serverweekday);}}/*------------------DropListEvent.js----------------------*/window.onunload = function(){ for (vari=0;i<global_removers.length;i++){ if (document.detachEvent){global_removers[i].object.detachEvent("on"+global_removers[i].event,global_removers[i].func);}else{global_removers[i].object.removeEventListener(global_removers[i].event,global_removers[i].func,true);} } delete global_removers;}imgClick = function(e){ if (!e) e = window.event; if(e.stopPropagation){ e.stopPropagation(); }else{ e.cancelBubble = true;} var obj; if (e.srcElement){ obj=e.srcElement; }else{ obj=e.target; }var droplist;if(global_droplist[obj.previousSibling.getAttribute("id")]){droplist=global_droplist[obj.previousSibling.getAttribute("id")];}else{droplist=global_droplist[obj.previousSibling.getAttribute("name")]; };if (droplist.isopen==0){ droplist.open(); droplist.isopen=1; }else{droplist.close(); droplist.isopen=0; } /*when a drop list clicked ,make others closed*/ closeAll(e); /*move div to the object position*/var tmpobj = obj; var xl=0; /*scrollLeft*/ var xt=0; /*scrollTop*/ do{if (!isNaN(tmpobj.scrollTop)){ xt+=tmpobj.scrollTop;xl+=tmpobj.scrollLeft; } tmpobj=tmpobj.parentNode; if(tmpobj.tagName=="DIV"){ if (tmpobj.addEventListener){tmpobj.addEventListener("scroll",scrollDiv,true); }else{tmpobj.attachEvent("onscroll",scrollDiv); } global_removers.push(new Remover(tmpobj,"scroll",scrollDiv)) } } while (tmpobj.tagName!="BODY"); function scrollDiv(){ rePositionDiv(obj,droplist); } var input = obj.previousSibling; var l=0; var t=0; t=input.offsetTop; l=input.offsetLeft; while(input=input.offsetParent){ t+=input.offsetTop; l+=input.offsetLeft; } document.getElementById(droplist.dropDivName).style.top=(t+22-xt)+"px"; document.getElementById(droplist.dropDivName).style.left=(l-xl)+"px";}/*select object in a div , when it scrolls , move the droplist to a right position*/rePositionDiv = function(obj,droplist){ var tmpobj = obj; var xl=0; /*scrollLeft*/ var xt=0; /*scrollTop*/ do{ if (!isNaN(tmpobj.scrollTop)){ xt+=tmpobj.scrollTop; xl+=tmpobj.scrollLeft; } tmpobj=tmpobj.parentNode; } while (tmpobj.tagName!="BODY"); var input = obj.previousSibling; var l=0; var t=0; t=input.offsetTop; l=input.offsetLeft; while(input=input.offsetParent){ t+=input.offsetTop; l+=input.offsetLeft; } document.getElementById(droplist.dropDivName).style.top=(t+22-xt)+"px"; document.getElementById(droplist.dropDivName).style.left=(l-xl)+"px";}closeAll = function(e){ if (!e) e = window.event; var obj; if (e.srcElement){ obj=e.srcElement; }else{ obj=e.target; } if (obj.tagName=="A" || obj.tagName=="INPUT"){ obj=obj.parentNode; if (obj.getAttribute("id")=="__adders"){ return; } } if (obj.tagName=="TD"){ if (obj.getAttribute("id")=="__adders"){ return; } } var divName=null; var droplist=null; for (var n in global_droplist){ if (global_droplist[n].isopen==1){ droplist=global_droplist[n]; } divName = global_droplist[n].dropDivName; } if (droplist!=null && obj.tagName!="IMG"){ global_droplist[droplist.id].isopen=0; document.getElementById(divName).innerHTML=""; document.getElementById(divName).style.display="none"; }}dropListGetValue = function(droplistid,index){ var droplist=global_droplist[droplistid]; var item=droplist.getItemAt(index); var input=document.getElementById(droplist.id); if (input==null){ input=document.getElementsByName(droplist.id)[0]; } input.value=item.label; input.setAttribute("data",item.data)}dropDateFill = function(droplist,y,m,d,w){ var today=new Date(); if (!y){ y=today.getFullYear(); m=today.getMonth()+1; d=today.getDate(); w=today.getDay(); } var table = document.getElementById(droplist.dropDivName).getElementsByTagName("TABLE")[0]; var tds = table.getElementsByTagName("TD"); var yearInput = document.getElementById(droplist.dropDivName).getElementsByTagName("INPUT")[0]; var monthInput = document.getElementById(droplist.dropDivName).getElementsByTagName("INPUT")[1]; yearInput.value = y; monthInput.value = m; var wMonthFirstDay = new Date(y+"/"+m+"/1").getDay(); var monthDays = getThisMonthDays(y,m); var pmonth = m-1; var pyear = y; if (pmonth==0){ pmonth=12; pyear--; } var pmonthDays = getThisMonthDays(pyear,pmonth); yearInput.setAttribute("y",y); yearInput.setAttribute("m",m); yearInput.setAttribute("d",1); yearInput.setAttribute("w",wMonthFirstDay); for (var i=7;i<tds.length-2;i++){ if (i>6+wMonthFirstDay && i<6+wMonthFirstDay+monthDays+1){ tds[i].innerHTML=i-(6+wMonthFirstDay); tds[i].setAttribute("d",i-(6+wMonthFirstDay)); tds[i].setAttribute("m",m); tds[i].setAttribute("y",y); tds[i].style.color=""; }else{ if (i<=6+wMonthFirstDay){ var mx=m-1; var my=y; if (mx<1){mx=12;my-=1;}; tds[i].innerHTML=i-(6+wMonthFirstDay)+pmonthDays; tds[i].setAttribute("d",i-(6+wMonthFirstDay)+pmonthDays); tds[i].setAttribute("m",mx); tds[i].setAttribute("y",my); }else{ var mx=m+1; var my=y; if (mx>12){mx=1;my+=1;}; tds[i].innerHTML=i-(6+wMonthFirstDay)-monthDays; tds[i].setAttribute("d",i-(6+wMonthFirstDay)-monthDays); tds[i].setAttribute("m",mx); tds[i].setAttribute("y",my); } tds[i].style.color="#cccccc"; } } tds[tds.length-1].innerHTML = y+" 年 "+m+" 月 "+d+" 日";}/*how many days in the argue year and month it returns*/getThisMonthDays=function(ye,mo){ var yflag = false; var days = 0; if(ye%100 == 0) { ye /= 100; } if (ye%4 == 0) { yflag = true; } if ((mo== 1) || (mo == 3) || (mo == 5) || (mo == 7) || (mo == 8) || (mo == 10)|| (mo == 12)) { days = 31; } else if (mo != 2) { days = 30; } else if(yflag) { days = 29; } else { days = 28; } return days;}dropNextMonth = function(obj,droplistid){ /*obj,the year Input,whichsave date input object*/ y=obj.getAttribute("y");m=obj.getAttribute("m"); d=obj.getAttribute("d"); var newy=y; varnewm=m; var newd=d; var neww=w; newm++; if (newm>12){ newm=1;newy++; } var w = new Date(newy+"/"+newm+"/"+d).getDay();dropDateFill(global_droplist[droplistid],newy,newm,d,w);}dropNextYear = function(obj,droplistid){ /*obj,the year Input,whichsave date input object*/ y=obj.getAttribute("y");m=obj.getAttribute("m"); d=obj.getAttribute("d"); var newy=y; varnewm=m; var newd=d; var neww=w; newy++; var w = newDate(newy+"/"+newm+"/"+d).getDay();dropDateFill(global_droplist[droplistid],newy,newm,d,w);}dropPrevYear = function(obj,droplistid){ /*obj,the year Input,whichsave date input object*/ y=obj.getAttribute("y");m=obj.getAttribute("m"); d=obj.getAttribute("d"); var newy=y; varnewm=m; var newd=d; var neww=w; newy--; var w = newDate(newy+"/"+newm+"/"+d).getDay();dropDateFill(global_droplist[droplistid],newy,newm,d,w);}dropPrevMonth = function(obj,droplistid){ /*obj,the year Input,whichsave date input object*/ y=obj.getAttribute("y");m=obj.getAttribute("m"); d=obj.getAttribute("d"); var newy=y; varnewm=m; var newd=d; var neww=w; newm--; if (newm<1){ newm=12;newy--; } var w = new Date(newy+"/"+newm+"/"+d).getDay();dropDateFill(global_droplist[droplistid],newy,newm,d,w);}dropGoMonth = function(obj,droplistid){ varobjs=obj.nextSibling.nextSibling.nextSibling.nextSibling.nextSibling;var y=obj.getAttribute("y"); var m=obj.getAttribute("m"); vard=obj.getAttribute("d"); if (isNaN(objs.value)){ objs.value=m; return;} if (parseInt(objs.value)>12 || parseInt(objs.value)<1){objs.value=m; return; } var newm=parseInt(objs.value); var w = newDate(y+"/"+newm+"/"+d).getDay();dropDateFill(global_droplist[droplistid],y,newm,d,w);}dropGoYear = function(obj,droplistid){ var y=obj.getAttribute("y"); varm=obj.getAttribute("m"); var d=obj.getAttribute("d"); if(isNaN(obj.value)){ obj.value=y; return; } if(parseInt(obj.value)>2100 || parseInt(obj.value)<1900){obj.value=y; return; } var newy=parseInt(obj.value); var w = newDate(newy+"/"+m+"/"+d).getDay();dropDateFill(global_droplist[droplistid],newy,m,d,w);}getDropListDate = function(tdobj,droplistid){ vary=tdobj.getAttribute("y"); var m=tdobj.getAttribute("m"); vard=tdobj.getAttribute("d"); var droplist=global_droplist[droplistid];var input = document.getElementById(droplistid); if (!input){ input =document.getElementsByName(droplistid)[0]; } vardf=droplist.dropDateFormat; df = df.replace("yyyy",y); df =df.replace("yy",y.toString().substring(y.toString().length-2,y.toString().length));df = df.replace("mm",m); df = df.replace("dd",d); input.value=df;}//--></SCRIPT><BODY><div name="droplist2" type="text"value=""></div><INPUT name="droplist3" type="text" value=""><INPUT name="droplist4" type="text" value=""><SCRIPT LANGUAGE=""><!--drop = new DropList("droplist2");drop.editable=true;drop.width=200;drop.addItem("1","abcde");drop.addItem("2","bbasfg");drop.addItem("3","cfnja");drop.addItem("4","dkdmn");drop.addItem("5","elnmvg");drop.addItem("6","fkbgmkb");drop.addItem("7","gslmrvj");drop.addItem("8","hukweh");drop.addItem("9","iuihlkv");drop.addItem("10","jgzjng");drop.addItem("1","agfsdbcde");drop.addItem("2","bfasdfbasfg");drop.addItem("3","caadffnja");drop.addItem("4","ddfdaskdmn");drop.addItem("5","eccalnmvg");drop.addItem("6","feekbgmkb");drop.addItem("7","gfasdfslmrvj");drop.addItem("8","hgggukweh");drop.addItem("9","icadfuihlkv");drop.addItem("10","jerghhgzjng");drop.refresh();drop2 = new DropList("droplist3");drop2.refresh();drop4 = new DropList("droplist4");drop4.dropDate = true;drop4.dropDateFormat="mm/dd/yy";drop4.width=150;drop4.refresh();//--></SCRIPT></BODY></HTML><HTML><HEAD><TITLE></TITLE><!--<script language="javascript" src="PopupCalendar.js"></script>--><script> //// Powered by: amo//// QQ:48176084//// Email & MSN :phoubeshotmail.com functionPopupCalendar(InstanceName){ ///Global Tag this.instanceName=InstanceName; ///Propertiesthis.separator="-" this.oBtnTodayTitle="Today"this.oBtnCancelTitle="Cancel" this.weekDaySting=newArray("S","M","T","W","T","F","S"); this.monthSting=newArray("January","February","March","April","May","June","July","August","September","October","November","December");this.Width=200; this.currDate=new Date(); this.today=new Date();this.startYear=1970; this.endYear=2010; ///Css this.divBorderCss="1pxsolid #BCD0DE"; this.tableBorderColor="#CCCCCC" ///Methodthis.Init=CalendarInit; this.Fill=CalendarFill;this.Refresh=CalendarRefresh; this.Restore=CalendarRestore;///HTMLObject this.oTaget=null; this.oPreviousCell=null;this.sDIVID=InstanceName+"oDiv"; this.sTABLEID=InstanceName+"oTable";this.sMONTHID=InstanceName+"oMonth"; this.sYEARID=InstanceName+"oYear";}function CalendarInit() ///Create panel{ var sMonth,sYear sMonth=this.currDate.getMonth();sYear=this.currDate.getYear(); htmlAll="<div id='"+this.sDIVID+"' align='center'>"; /// Month htmloMonth="<selectid='"+this.sMONTHID+"'onchange=CalendarMonthChange("+this.instanceName+") for(i=0;i<12;i++) { htmloMonth+="<optionvalue='"+i+"'>"+this.monthSting[i]+"</option>"; }htmloMonth+="</select>"; /// Year htmloYear="<selectid='"+this.sYEARID+"'onchange=CalendarYearChange("+this.instanceName+") for(i=this.startYear;i<=this.endYear;i++) {htmloYear+="<option value='"+i+"'>"+i+"</option>"; }htmloYear+="</select></div>"; /// DayhtmloDayTable="<table id='"+this.sTABLEID+"' width='100%' border=0cellpadding=0 cellspacing=1 bgcolor='"+this.tableBorderColor+"'>";htmloDayTable+="<tbody bgcolor='#ffffff' { if(i==0) htmloDayTable+="<trbgcolor='#98B8CD'>"; else htmloDayTable+="<tr>";for(j=0;j<7;j++) { if(i==0) { htmloDayTable+="<td height='20'align='center' valign='middle' } else {htmloDayTable+="<td height='20' align='center' valign='middle' htmloDayTable+="onmouseover=CalendarCellsMsOver("+this.instanceName+")";htmloDayTable+=" onmouseout=CalendarCellsMsOut("+this.instanceName+")";htmloDayTable+="onclick=CalendarCellsClick(this,"+this.instanceName+")>";htmloDayTable+=" </td>" } } htmloDayTable+="</tr>"; }htmloDayTable+="</tbody></table>"; /// Today ButtonhtmloButton="<div align='center' solid#BCD0DE;background-color:#eeeeee;cursor:hand'" htmloButton+="onclick=CalendarTodayClick("+this.instanceName+")>"+this.oBtnTodayTitle+"</button>" htmloButton+="<button solid#BCD0DE;background-color:#eeeeee;cursor:hand'" htmloButton+="onclick=CalendarCancel("+this.instanceName+")>"+this.oBtnCancelTitle+"</button>" htmloButton+="</div>" /// AllhtmlAll=htmlAll+htmloMonth+htmloYear+htmloDayTable+htmloButton+"</div>";document.write(htmlAll); this.Fill(); }function CalendarFill() ///{ varsMonth,sYear,sWeekDay,sToday,oTable,currRow,MaxDay,sDaySn,sIndex,rowIndex,cellIndex,oSelectMonth,oSelectYearsMonth=this.currDate.getMonth(); sYear=this.currDate.getYear();sWeekDay=(new Date(sYear,sMonth,1)).getDay();sToday=this.currDate.getDate(); oTable=document.all[this.sTABLEID];currRow=oTable.rows[1]; MaxDay=CalendarGetMaxDay(sYear,sMonth);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="<fontcolor=red><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="<fontcolor=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() /// Clear Data{ 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.Restore(); this.Fill(); }function CalendarCellsMsOver(oInstance) /// Cell MouseOver{ var myCell myCell=event.srcElement;CalendarCellSetCss(0,oInstance.oPreviousCell); if(myCell) {CalendarCellSetCss(1,myCell); oInstance.oPreviousCell=myCell; }}function CalendarCellsMsOut(oInstance) ////// Cell 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);///return sDateString if(oInstance.oTaget.tagName=="INPUT") {oInstance.oTaget.value=sDateString; }document.all[oInstance.sDIVID].style.display="none"; }function CalendarYearChange(oInstance) /// Year Change{ var sDay,sMonth,sYear,newDate sDay=oInstance.currDate.getDate();sMonth=oInstance.currDate.getMonth();sYear=document.all[oInstance.sYEARID].value newDate=newDate(sYear,sMonth,sDay); oInstance.Refresh(newDate);}function CalendarMonthChange(oInstance) /// Month Change{ var sDay,sMonth,sYear,newDate sDay=oInstance.currDate.getDate();sMonth=document.all[oInstance.sMONTHID].valuesYear=oInstance.currDate.getYear(); newDate=newDate(sYear,sMonth,sDay); oInstance.Refresh(newDate); }function CalendarTodayClick(oInstance) /// "Today" button 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,"Left");CalendarDiv.style.pixelTop=CalendargetPos(oInputSrc,"Top")+oInputSrc.offsetHeight;CalendarDiv.style.display=(CalendarDiv.style.display=="none")?"":"none";} }function CalendarCellSetCss(sMode,oCell) /// Set Cell Css{ // sMode // 0: OnMouserOut 1: OnMouseOver if(sMode) {oCell.style.border="1px solid #5589AA";oCell.style.backgroundColor="#BCD0DE"; } else { oCell.style.border="1pxsolid #FFFFFF"; oCell.style.backgroundColor="#FFFFFF"; } }function CalendarGetMaxDay(nowYear,nowMonth) /// Get MaxDay of currentmonth{ var nextMonth,nextYear,currDate,nextDate,theMaxDaynextMonth=nowMonth+1; if(nextMonth>11) { nextYear=nowYear+1;nextMonth=0; } else { nextYear=nowYear; } currDate=newDate(nowYear,nowMonth,1); nextDate=new Date(nextYear,nextMonth,1);theMaxDay=(nextDate-currDate)/(24*60*60*1000); return theMaxDay;}function CalendargetPos(el,ePro) /// Get Absolute Position{ var ePos=0; while(el!=null) { ePos+=el["offset"+ePro];el=el.offsetParent; } return ePos;}function CalendarDblNum(num){ if(num<10) return "0"+num; else return num;}function CalendarCancel(oInstance) ///Cancel{ CalendarDiv=document.all[oInstance.sDIVID];CalendarDiv.style.display="none"; }</script></head><BODY ><script >var oCalendarEn=new PopupCalendar("oCalendarEn");//初始化控件时,请给出实例名称如:oCalendarEnoCalendarEn.Init();var oCalendarChs=new PopupCalendar("oCalendarChs");//初始化控件时,请给出实例名称:oCalendarChsoCalendarChs.weekDaySting=new Array("日","一","二","三","四","五","六");oCalendarChs.monthSting=newArray("一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月");oCalendarChs.oBtnTodayTitle="今天";oCalendarChs.oBtnCancelTitle="取消";oCalendarChs.Init();</script> <input readonly type="text" name="dd" id="aa" value="English Version"> <input readonly type="text" name="dd" id="aa" value="中文界面版"></BODY></HTML>