First:
In fact, if you change from the previous month to the next month or last month, the current selection will still be saved and displayed as shown in the beginning.
This batch select date can be used in some scenarios, such as planning or querying.
First, declare: This is an adapted multi-Choice Date plug-in. It turns out to be a common but practical calendar control. Thanks again to the original author.
A class is designed. The main idea is to: (block the code that disappears after selection, remember the selected and colored date, and display the date that was previously remembered based on the current data in the Drawing Process of the date control area .)
Function $2 (ID) {return document. getelementbyid (ID);} function selectdatecache () {This. cache = []; // The selected and colored date is stored in this array this. add = function (sdate) {If (! This. exist (sdate) This. cache. push (sdate) ;}; this. clear = function () {This. cache. splice (0, this. cache. length) ;}; this. remove = function (sdate) {for (VAR I = 0, L = This. cache. length; I <L; I ++) {If (this. cache [I] = sdate) {This. cache. splice (I, 1); break ;}}; this. exist = function (sdate) {for (VAR I = 0, L = This. cache. length; I <L; I ++) {If (this. cache [I] = sdate) {return true ;}} return false ;}; this. getrelatecontrolidbydate = function (sdate) {var SDAY = '', smonth ='', syear = ''; var stemp = sdate. split ('-'); If (stemp [1]. substr (0, 1) = '0') {smonth = stemp [1]. substr (1);} else {smonth = stemp [1];} smonth = (parseint (smonth + '')-1) +" "; if (stemp [2]. substr (0, 1) = '0') {SDAY = stemp [2]. substr (1, 1);} else {SDAY = stemp [2];} syear = stemp [0]; vaR controlid = "day-" + SDAY + "-" + smonth + "-" + syear; return controlid ;}; this. getdatefromcontrolid = function (scontrolid) {// day-16-1-2013 var stemp = scontrolid. split ('-'); If (stemp [1]. length = 1) stemp [1] = '0' + stemp [1]; stemp [2] = (parseint (stemp [2]) + 1) + ""; if (stemp [2]. length = 1) stemp [2] = '0' + stemp [2]; return stemp [3] + '-' + stemp [2] + '-' + stemp [1] ;};} var aselectcontroller = new selectdatecache ();
Code of the front-end page:
<HTML xmlns = "http://www.w3.org/1999/xhtml">
In addition, I have uploaded the referenced JS and CSS files to the files in the garden, but I have been searching for them for a long time, I don't know how to display the resources in the files in blog management in some way in the current document.
It's a bit cold outside, and I feel a little sleepy ..