{"id":473,"date":"2010-10-01T02:50:43","date_gmt":"2010-10-01T02:50:43","guid":{"rendered":"http:\/\/enjoyasp.net\/?p=473"},"modified":"2010-10-01T02:50:43","modified_gmt":"2010-10-01T02:50:43","slug":"%e6%97%a5%e6%9c%9f%e9%80%89%e6%8b%a9%e5%99%a8-%e6%8e%a7%e4%bb%b6%e4%bb%a3%e7%a0%81","status":"publish","type":"post","link":"https:\/\/enjoyasp.net\/index.php\/2010\/10\/01\/%e6%97%a5%e6%9c%9f%e9%80%89%e6%8b%a9%e5%99%a8-%e6%8e%a7%e4%bb%b6%e4%bb%a3%e7%a0%81\/","title":{"rendered":"\u65e5\u671f\u9009\u62e9\u5668&#8211;\u63a7\u4ef6\u4ee3\u7801"},"content":{"rendered":"<pre lang=\"javascript\">\r\nfunction PopupCalendar(InstanceName)\r\n{\r\n\/\/\/Global Tag\r\nthis.instanceName=InstanceName;\r\n\/\/\/Properties\r\nthis.separator=\"-\"\r\nthis.oBtnTodayTitle=\"Today\"\r\nthis.oBtnCancelTitle=\"Cancel\"\r\nthis.weekDaySting=new Array(\"S\",\"M\",\"T\",\"W\",\"T\",\"F\",\"S\");\r\nthis.monthSting=new Array(\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\"July\",\"August\",\"September\",\"October\",\"November\",\"December\");\r\nthis.Width=200;\r\nthis.currDate=new Date();\r\nthis.today=new Date();\r\nthis.startYear=1970;\r\nthis.endYear=2010;\r\n\/\/\/Css\r\nthis.normalfontColor=\"#666666\";\r\nthis.selectedfontColor=\"red\";\r\nthis.divBorderCss=\"1px solid #BCD0DE\";\r\nthis.titleTableBgColor=\"#98B8CD\";\r\nthis.tableBorderColor=\"#CCCCCC\"\r\n\/\/\/Method\r\nthis.Init=CalendarInit;\r\nthis.Fill=CalendarFill;\r\nthis.Refresh=CalendarRefresh;\r\nthis.Restore=CalendarRestore;\r\n\/\/\/HTMLObject\r\nthis.oTaget=null;\r\nthis.oPreviousCell=null;\r\nthis.sDIVID=InstanceName+\"_Div\";\r\nthis.sTABLEID=InstanceName+\"_Table\";\r\nthis.sMONTHID=InstanceName+\"_Month\";\r\nthis.sYEARID=InstanceName+\"_Year\";\r\nthis.sTODAYBTNID=InstanceName+\"_TODAYBTN\";\r\n}\r\nfunction CalendarInit() \/\/\/Create panel\r\n{\r\nvar sMonth,sYear\r\nsMonth=this.currDate.getMonth();\r\nsYear=this.currDate.getYear();\r\nhtmlAll=\"<div id='\"+this.sDIVID+\"' style='display:none;position:absolute;width:\"+this.Width+\";border:\"+this.divBorderCss+\";padding:2px;background-color:#FFFFFF'>\";\r\nhtmlAll+=\"<div align='center'>\";\r\n\/\/\/ Month\r\nhtmloMonth=\"<select id='\"+this.sMONTHID+\"' onchange=CalendarMonthChange(\"+this.instanceName+\") style='width:50%'>\";\r\nfor(i=0;i<12;i++)\r\n{ \r\nhtmloMonth+=\"<option value='\"+i+\"'>\"+this.monthSting[i]+\"<\/option>\";\r\n}\r\nhtmloMonth+=\"<\/select>\";\r\n\/\/\/ Year\r\nhtmloYear=\"<select id='\"+this.sYEARID+\"' onchange=CalendarYearChange(\"+this.instanceName+\") style='width:50%'>\";\r\nfor(i=this.startYear;i<=this.endYear;i++)\r\n{\r\nhtmloYear+=\"<option value='\"+i+\"'>\"+i+\"<\/option>\";\r\n}\r\nhtmloYear+=\"<\/select><\/div>\";\r\n\/\/\/ Day\r\nhtmloDayTable=\"<table id='\"+this.sTABLEID+\"' width='100%' border=0 cellpadding=0 cellspacing=1 bgcolor='\"+this.tableBorderColor+\"'>\";\r\nhtmloDayTable+=\"<tbody bgcolor='#ffffff'style='font-size:13px'>\";\r\nfor(i=0;i<=6;i++)\r\n{\r\nif(i==0)\r\nhtmloDayTable+=\"<tr bgcolor='\" + this.titleTableBgColor + \"'>\";\r\nelse\r\nhtmloDayTable+=\"<tr>\";\r\nfor(j=0;j<7;j++)\r\n{\r\n\r\n\r\nif(i==0)\r\n{\r\nhtmloDayTable+=\"<td height='20' align='center' valign='middle' style='cursor:hand'>\";\r\nhtmloDayTable+=this.weekDaySting[j]+\"<\/td>\"\r\n}\r\nelse\r\n{\r\nhtmloDayTable+=\"<td height='20' align='center' valign='middle' style='cursor:hand'\";\r\nhtmloDayTable+=\" onmouseover=CalendarCellsMsOver(\"+this.instanceName+\")\";\r\nhtmloDayTable+=\" onmouseout=CalendarCellsMsOut(\"+this.instanceName+\")\";\r\nhtmloDayTable+=\" onclick=CalendarCellsClick(this,\"+this.instanceName+\")>\";\r\nhtmloDayTable+=\"&nbsp;<\/td>\"\r\n}\r\n}\r\nhtmloDayTable+=\"<\/tr>\"; \r\n}\r\nhtmloDayTable+=\"<\/tbody><\/table>\";\r\n\/\/\/ Today Button\r\nhtmloButton=\"<div align='center' style='padding:3px'>\"\r\nhtmloButton+=\"<button id='\"+this.sTODAYBTNID+\"' style='width:40%;border:1px solid #BCD0DE;background-color:#eeeeee;cursor:hand'\"\r\nhtmloButton+=\" onclick=CalendarTodayClick(\"+this.instanceName+\")>\"+this.oBtnTodayTitle+\"<\/button>&nbsp;\"\r\nhtmloButton+=\"<button style='width:40%;border:1px solid #BCD0DE;background-color:#eeeeee;cursor:hand'\"\r\nhtmloButton+=\" onclick=CalendarCancel(\"+this.instanceName+\")>\"+this.oBtnCancelTitle+\"<\/button> \"\r\nhtmloButton+=\"<\/div>\"\r\n\/\/\/ All\r\nhtmlAll=htmlAll+htmloMonth+htmloYear+htmloDayTable+htmloButton+\"<\/div>\";\r\ndocument.write(htmlAll);\r\nthis.Fill(); \r\n}\r\nfunction CalendarFill() \/\/\/\r\n{\r\nvar sMonth,sYear,sWeekDay,sToday,oTable,currRow,MaxDay,iDaySn,sIndex,rowIndex,cellIndex,oSelectMonth,oSelectYear\r\nsMonth=this.currDate.getMonth();\r\nsYear=this.currDate.getYear();\r\nsWeekDay=(new Date(sYear,sMonth,1)).getDay();\r\nsToday=this.currDate.getDate();\r\niDaySn=1\r\noTable=document.all[this.sTABLEID];\r\ncurrRow=oTable.rows[1];\r\nMaxDay=CalendarGetMaxDay(sYear,sMonth);\r\noSelectMonth=document.all[this.sMONTHID]\r\noSelectMonth.selectedIndex=sMonth;\r\noSelectYear=document.all[this.sYEARID]\r\nfor(i=0;i<oSelectYear.length;i++)\r\n{\r\nif(parseInt(oSelectYear.options[i].value)==sYear)oSelectYear.selectedIndex=i;\r\n}\r\n\/\/\/\/\r\nfor(rowIndex=1;rowIndex<=6;rowIndex++)\r\n{\r\nif(iDaySn>MaxDay)break;\r\ncurrRow = oTable.rows[rowIndex];\r\ncellIndex = 0;\r\nif(rowIndex==1)cellIndex = sWeekDay;\r\nfor(;cellIndex<currRow.cells.length;cellIndex++)\r\n{\r\nif(iDaySn==sToday)\r\n{\r\ncurrRow.cells[cellIndex].innerHTML=\"<font color='\"+this.selectedfontColor+\"'><i><b>\"+iDaySn+\"<\/b><\/i><\/font>\";\r\nthis.oPreviousCell=currRow.cells[cellIndex];\r\n}\r\nelse\r\n{\r\ncurrRow.cells[cellIndex].innerHTML=iDaySn; \r\ncurrRow.cells[cellIndex].style.color=this.normalfontColor;\r\n}\r\nCalendarCellSetCss(0,currRow.cells[cellIndex]);\r\niDaySn++;\r\nif(iDaySn>MaxDay)break; \r\n}\r\n}\r\n}\r\nfunction CalendarRestore() \/\/\/ Clear Data\r\n{ \r\nvar i,j,oTable\r\noTable=document.all[this.sTABLEID]\r\nfor(i=1;i<oTable.rows.length;i++)\r\n{\r\nfor(j=0;j<oTable.rows[i].cells.length;j++)\r\n{\r\nCalendarCellSetCss(0,oTable.rows[i].cells[j]);\r\noTable.rows[i].cells[j].innerHTML=\"&nbsp;\";\r\n}\r\n} \r\n}\r\nfunction CalendarRefresh(newDate) \/\/\/\r\n{\r\nthis.currDate=newDate;\r\nthis.Restore(); \r\nthis.Fill(); \r\n}\r\nfunction CalendarCellsMsOver(oInstance) \/\/\/ Cell MouseOver\r\n{\r\nvar myCell = event.srcElement;\r\nCalendarCellSetCss(0,oInstance.oPreviousCell);\r\nif(myCell)\r\n{\r\nCalendarCellSetCss(1,myCell);\r\noInstance.oPreviousCell=myCell;\r\n}\r\n}\r\nfunction CalendarCellsMsOut(oInstance) \/\/\/\/\/\/ Cell MouseOut\r\n{\r\nvar myCell = event.srcElement;\r\nCalendarCellSetCss(0,myCell); \r\n}\r\nfunction CalendarYearChange(oInstance) \/\/\/ Year Change\r\n{\r\nvar sDay,sMonth,sYear,newDate\r\nsDay=oInstance.currDate.getDate();\r\nsMonth=oInstance.currDate.getMonth();\r\nsYear=document.all[oInstance.sYEARID].value\r\nnewDate=new Date(sYear,sMonth,sDay);\r\noInstance.Refresh(newDate);\r\n}\r\nfunction CalendarMonthChange(oInstance) \/\/\/ Month Change\r\n{\r\nvar sDay,sMonth,sYear,newDate\r\nsDay=oInstance.currDate.getDate();\r\nsMonth=document.all[oInstance.sMONTHID].value\r\nsYear=oInstance.currDate.getYear();\r\nnewDate=new Date(sYear,sMonth,sDay);\r\noInstance.Refresh(newDate); \r\n}\r\nfunction CalendarCellsClick(oCell,oInstance)\r\n{\r\nvar sDay,sMonth,sYear,newDate\r\nsYear=oInstance.currDate.getFullYear();\r\nsMonth=oInstance.currDate.getMonth();\r\nsDay=oInstance.currDate.getDate();\r\nif(oCell.innerText!=\" \")\r\n{\r\nsDay=parseInt(oCell.innerText);\r\nif(sDay!=oInstance.currDate.getDate())\r\n{\r\nnewDate=new Date(sYear,sMonth,sDay);\r\noInstance.Refresh(newDate);\r\n}\r\n}\r\nsDateString=sYear+oInstance.separator+CalendarDblNum(sMonth+1)+oInstance.separator+CalendarDblNum(sDay); \/\/\/return sDateString\r\nif(oInstance.oTaget.tagName.toLowerCase()==\"input\")oInstance.oTaget.value = sDateString;\r\nCalendarCancel(oInstance);\r\nreturn sDateString;\r\n}\r\nfunction CalendarTodayClick(oInstance) \/\/\/ \"Today\" button Change\r\n{ \r\noInstance.Refresh(new Date()); \r\n}\r\nfunction getDateString(oInputSrc,oInstance)\r\n{\r\nif(oInputSrc&#038;&#038;oInstance) \r\n{\r\nvar CalendarDiv=document.all[oInstance.sDIVID];\r\noInstance.oTaget=oInputSrc;\r\nCalendarDiv.style.pixelLeft=CalendargetPos(oInputSrc,\"Left\");\r\nCalendarDiv.style.pixelTop=CalendargetPos(oInputSrc,\"Top\") + oInputSrc.offsetHeight;\r\nCalendarDiv.style.display=(CalendarDiv.style.display==\"none\")?\"\":\"none\"; \r\n} \r\n}\r\nfunction CalendarCellSetCss(sMode,oCell) \/\/\/ Set Cell Css\r\n{\r\n\/\/ sMode\r\n\/\/ 0: OnMouserOut 1: OnMouseOver \r\nif(sMode)\r\n{\r\noCell.style.border=\"1px solid #5589AA\";\r\noCell.style.backgroundColor=\"#BCD0DE\";\r\n}\r\nelse\r\n{\r\noCell.style.border=\"1px solid #FFFFFF\";\r\noCell.style.backgroundColor=\"#FFFFFF\";\r\n} \r\n}\r\nfunction CalendarGetMaxDay(nowYear,nowMonth) \/\/\/ Get MaxDay of current month\r\n{\r\nvar nextMonth,nextYear,currDate,nextDate,theMaxDay\r\nnextMonth=nowMonth+1;\r\nif(nextMonth>11)\r\n{\r\nnextYear=nowYear+1;\r\nnextMonth=0;\r\n}\r\nelse \r\n{\r\nnextYear=nowYear; \r\n}\r\ncurrDate=new Date(nowYear,nowMonth,1);\r\nnextDate=new Date(nextYear,nextMonth,1);\r\ntheMaxDay=(nextDate-currDate)\/(24*60*60*1000);\r\nreturn theMaxDay;\r\n}\r\nfunction CalendargetPos(el,ePro) \/\/\/ Get Absolute Position\r\n{\r\nvar ePos=0;\r\nwhile(el!=null)\r\n{ \r\nePos+=el[\"offset\"+ePro];\r\nel=el.offsetParent;\r\n}\r\nreturn ePos;\r\n}\r\nfunction CalendarDblNum(num)\r\n{\r\nif(num < 10) \r\nreturn \"0\"+num;\r\nelse\r\nreturn num;\r\n}\r\nfunction CalendarCancel(oInstance) \/\/\/Cancel\r\n{\r\nvar CalendarDiv=document.all[oInstance.sDIVID];\r\nCalendarDiv.style.display=\"none\"; \r\n}\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>function PopupCalendar(InstanceName) { \/\/\/Global Tag th [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[14],"tags":[],"class_list":["post-473","post","type-post","status-publish","format-standard","hentry","category-14"],"blocksy_meta":[],"_links":{"self":[{"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/posts\/473","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/comments?post=473"}],"version-history":[{"count":0,"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/posts\/473\/revisions"}],"wp:attachment":[{"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/media?parent=473"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/categories?post=473"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/tags?post=473"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}