时间插件 非常简单实用

1,web控件的样子

2,日期时间选择的使用


  1. <script src="calendar.js" type="text/javascript" language="javascript"></script>  
  2. <input name="txtDate" type="text" value="2008-12-15 23:34:23" style="padding-left:5px;" id="txtDate" onclick="SetDate(this,'yyyy-MM-dd hh:mm:ss')" readonly="readonly" />  
  3. <input name="txtDate1" type="text" style="padding-left:5px;" id="txtDate" onclick="SetDate(this,'yyyy-MM-dd hh:mm')" readonly="readonly" />  
  4. <input name="txtDate2" type="text" style="padding-left:5px;" id="txtDate" onclick="SetDate(this)" readonly="readonly" />  
  5. <input name="txtDate3" type="button" style="padding-left:5px;" id="txtDate" onclick="SetDate(document.all.txtDate2,'yyyy-MM-dd')" readonly="readonly" />  

3,calendar.js的文件


[javascript] view plain copy
  1. <!--  
  2. var cal;  
  3. var isFocus=false//是否为焦点  
  4. function SetDate(obj,strFormat)  
  5. {  
  6.     var date = new Date();  
  7.     var by = date.getFullYear()-10; //最小值 → 10 年前  
  8.     var ey = date.getFullYear()+10; //最大值 → 10 年后  
  9.     //初始化为中文版,1为英文版  
  10.     cal = (cal==null) ? new Calendar(by, ey, 0,strFormat) : (cal.dateFormatStyle == strFormat ? cal : new Calendar(by, ey, 0,strFormat));  
  11.     cal.show(obj);  
  12. }  
  13. /**//* 返回日期 */  
  14. String.prototype.toDate = function(style){  
  15. var y = this.substring(style.indexOf('y'),style.lastIndexOf('y')+1);//年  
  16. var m = this.substring(style.indexOf('M'),style.lastIndexOf('M')+1);//月  
  17. var d = this.substring(style.indexOf('d'),style.lastIndexOf('d')+1);//日  
  18. var h = this.substring(style.indexOf('h'),style.lastIndexOf('h')+1);//时  
  19. var i = this.substring(style.indexOf('m'),style.lastIndexOf('m')+1);//分  
  20. var s = this.substring(style.indexOf('s'),style.lastIndexOf('s')+1);//秒  
  21. if(isNaN(y)) y = new Date().getFullYear();  
  22. if(isNaN(m)) m = new Date().getMonth();  
  23. if(isNaN(d)) d = new Date().getDate();  
  24. if(isNaN(h)) h = new Date().getHours();  
  25. if(isNaN(i)) i = new Date().getMinutes();  
  26. if(isNaN(s)) s = new Date().getSeconds();  
  27. var dt ;  
  28. eval ("dt = new Date('"+ y+"', '"+(m-1)+"','"+ d +"','"+ h +"','"+ i+"','"+ s +"')");  
  29. return dt;  
  30. }  
  31. /**//* 格式化日期 */  
  32. Date.prototype.format = function(style){  
  33. var o = {  
  34.     "M+" : this.getMonth() + 1, //month  
  35.     "d+" : this.getDate(),      //day  
  36.     "h+" : this.getHours(),     //hour  
  37.     "m+" : this.getMinutes(),   //minute  
  38.     "s+" : this.getSeconds(),   //second  
  39.     "w+" : "天一二三四五六".charAt(this.getDay()),   //week  
  40.     "q+" : Math.floor((this.getMonth() + 3) / 3), //quarter  
  41.     "S" : this.getMilliseconds() //millisecond  
  42. }  
  43. if(/(y+)/.test(style)){  
  44.     style = style.replace(RegExp.$1,  
  45.     (this.getFullYear() + "").substr(4 - RegExp.$1.length));  
  46. }  
  47. for(var k in o){  
  48.     if(new RegExp("("+ k +")").test(style)){  
  49.       style = style.replace(RegExp.$1,  
  50.         RegExp.$1.length == 1 ? o[k] :  
  51.         ("00" + o[k]).substr(("" + o[k]).length));  
  52.     }  
  53. }  
  54. return style;  
  55. };  
  56. /**//* 
  57. * 日历类 
  58. * @param   beginYear 1990 
  59. * @param   endYear   2010 
  60. * @param   lang      0(中文)|1(英语) 可自由扩充 
  61. * @param   dateFormatStyle "yyyy-MM-dd"; 
  62. */  
  63. function Calendar(beginYear, endYear, lang, dateFormatStyle){  
  64. this.beginYear = 1990;  
  65. this.endYear = 2010;  
  66. this.lang = 0;            //0(中文) | 1(英文)  
  67. this.dateFormatStyle = "yyyy-MM-dd";  
  68. if (beginYear != null && endYear != null){  
  69.     this.beginYear = beginYear;  
  70.     this.endYear = endYear;  
  71. }  
  72. if (lang != null){  
  73.     this.lang = lang  
  74. }  
  75. if (dateFormatStyle != null){  
  76.     this.dateFormatStyle = dateFormatStyle  
  77. }  
  78. this.dateControl = null;  
  79. this.panel = this.getElementById("calendarPanel");  
  80. this.container = this.getElementById("ContainerPanel");  
  81. this.form = null;  
  82. this.date = new Date();  
  83. this.year = this.date.getFullYear();  
  84. this.month = this.date.getMonth();  
  85. this.colors = {  
  86. "cur_word"      : "#FFFFFF"//当日日期文字颜色  
  87. "cur_bg"        : "#83A6F4"//当日日期单元格背影色  
  88. "sel_bg"        : "#FFCCCC"//已被选择的日期单元格背影色  
  89. "sun_word"      : "#FF0000"//星期天文字颜色  
  90. "sat_word"      : "#0000FF"//星期六文字颜色  
  91. "td_word_light" : "#333333"//单元格文字颜色  
  92. "td_word_dark" : "#CCCCCC"//单元格文字暗色  
  93. "td_bg_out"     : "#EFEFEF"//单元格背影色  
  94. "td_bg_over"    : "#FFCC00"//单元格背影色  
  95. "tr_word"       : "#FFFFFF"//日历头文字颜色  
  96. "tr_bg"         : "#666666"//日历头背影色  
  97. "input_border" : "#CCCCCC"//input控件的边框颜色  
  98. "input_bg"      : "#EFEFEF"   //input控件的背影色  
  99. }  
  100. this.draw();  
  101. this.bindYear();  
  102. this.bindMonth();  
  103. this.changeSelect();  
  104. this.bindData();  
  105. }  
  106. /**//* 
  107. * 日历类属性(语言包,可自由扩展) 
  108. */  
  109. Calendar.language ={  
  110. "year"   : [[""], [""]],  
  111. "months" : [["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],  
  112.         ["JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"]  
  113.          ],  
  114. "weeks" : [["日","一","二","三","四","五","六"],  
  115.         ["SUN","MON","TUR","WED","THU","FRI","SAT"]  
  116.          ],  
  117. "abort" : [["时间"], ["TIME"]],  
  118. "clear" : [["清空"], ["CLS"]],  
  119. "today" : [["今天"], ["TODAY"]],  
  120. "close" : [["关闭"], ["CLOSE"]]  
  121. }  
  122. Calendar.prototype.draw = function(){  
  123. calendar = this;  
  124. var mvAry = [];  
  125. mvAry[mvAry.length] = ' <div name="calendarForm" style="margin: 0px;">';  
  126. mvAry[mvAry.length] = '    <table width="100%" border="0" cellpadding="0" cellspacing="1">';  
  127. mvAry[mvAry.length] = '      <tr>';  
  128. mvAry[mvAry.length] = '        <th align="left" width="1%"><input style="border: 1px solid ' + calendar.colors["input_border"] + ';background-color:' + calendar.colors["input_bg"] + ';width:16px;height:20px;" name="prevMonth" type="button" id="prevMonth" value="<" /></th>';  
  129. mvAry[mvAry.length] = '        <th align="center" width="98%" nowrap="nowrap"><select name="calendarYear" id="calendarYear" style="font-size:12px;"></select><select name="calendarMonth" id="calendarMonth" style="font-size:12px;"></select></th>';  
  130. mvAry[mvAry.length] = '        <th align="right" width="1%"><input style="border: 1px solid ' + calendar.colors["input_border"] + ';background-color:' + calendar.colors["input_bg"] + ';width:16px;height:20px;" name="nextMonth" type="button" id="nextMonth" value=">" /></th>';  
  131. mvAry[mvAry.length] = '      </tr>';  
  132. mvAry[mvAry.length] = '    </table>';  
  133. mvAry[mvAry.length] = '    <table id="calendarTable" width="100%" style="border:0px solid #CCCCCC;background-color:#FFFFFF" border="0" cellpadding="3" cellspacing="1">';  
  134. mvAry[mvAry.length] = '      <tr>';  
  135. for(var i = 0; i < 7; i++){  
  136.     mvAry[mvAry.length] = '      <th style="font-weight:normal;background-color:' + calendar.colors["tr_bg"] + ';color:' + calendar.colors["tr_word"] + ';">' + Calendar.language["weeks"][this.lang][i] + '</th>';  
  137. }  
  138. mvAry[mvAry.length] = '      </tr>';  
  139. for(var i = 0; i < 6;i++){  
  140.     mvAry[mvAry.length] = '    <tr align="center">';  
  141.     for(var j = 0; j < 7; j++){  
  142.       if (j == 0){  
  143.         mvAry[mvAry.length] = ' <td style="cursor:default;color:' + calendar.colors["sun_word"] + ';"></td>';  
  144.       } else if(j == 6){  
  145.         mvAry[mvAry.length] = ' <td style="cursor:default;color:' + calendar.colors["sat_word"] + ';"></td>';  
  146.       } else{  
  147.         mvAry[mvAry.length] = ' <td style="cursor:default;"></td>';  
  148.       }  
  149.     }  
  150.     mvAry[mvAry.length] = '    </tr>';  
  151. }  
  152. mvAry[mvAry.length] = '      <tr align="center" style="font-size:12px;">';  
  153. mvAry[mvAry.length] = '        <td name="abort" id="abort" colspan="1" style="cursor:default;">' + Calendar.language["abort"][this.lang] + '</td>';  
  154. mvAry[mvAry.length] = '        <td colspan="6"><select name="calendarHour" id="calendarHour"></select>';  
  155. mvAry[mvAry.length] = ':<select name="calendarMinute" id="calendarMinute"></select>';  
  156. mvAry[mvAry.length] = ':<select name="calendarSecond" id="calendarSecond"></select>';  
  157. mvAry[mvAry.length] = '      </td></tr>';  
  158. mvAry[mvAry.length] = '      <tr style="background-color:' + calendar.colors["input_bg"] + ';">';  
  159. mvAry[mvAry.length] = '        <th colspan="2"><input name="calendarClear" type="button" id="calendarClear" value="' + Calendar.language["clear"][this.lang] + '" style="border: 1px solid ' + calendar.colors["input_border"] + ';background-color:' + calendar.colors["input_bg"] + ';width:100%;height:20px;font-size:12px;"/></th>';  
  160. mvAry[mvAry.length] = '        <th colspan="3"><input name="calendarToday" type="button" id="calendarToday" value="' + Calendar.language["today"][this.lang] + '" style="border: 1px solid ' + calendar.colors["input_border"] + ';background-color:' + calendar.colors["input_bg"] + ';width:100%;height:20px;font-size:12px;"/></th>';  
  161. mvAry[mvAry.length] = '        <th colspan="2"><input name="calendarClose" type="button" id="calendarClose" value="' + Calendar.language["close"][this.lang] + '" style="border: 1px solid ' + calendar.colors["input_border"] + ';background-color:' + calendar.colors["input_bg"] + ';width:100%;height:20px;font-size:12px;"/></th>';  
  162. mvAry[mvAry.length] = '      </tr>';  
  163. mvAry[mvAry.length] = '    </table>';  
  164. mvAry[mvAry.length] = ' </div>';  
  165. this.panel.innerHTML = mvAry.join("");  
  166. var obj = this.getElementById("prevMonth");  
  167. obj.onclick = function (){calendar.goPrevMonth(calendar);}  
  168. obj.onblur = function (){calendar.onblur();}  
  169. this.prevMonth= obj;  
  170. obj = this.getElementById("nextMonth");  
  171. obj.onclick = function (){calendar.goNextMonth(calendar);}  
  172. obj.onblur = function (){calendar.onblur();}  
  173. this.nextMonth= obj;  
  174. obj = this.getElementById("calendarClear");  
  175. obj.onclick = function (){calendar.dateControl.value = "";calendar.hide();}  
  176. this.calendarClear = obj;  
  177. obj = this.getElementById("calendarClose");  
  178. obj.onclick = function (){calendar.hide();}  
  179. this.calendarClose = obj;  
  180. obj = this.getElementById("calendarYear");  
  181. obj.onchange = function (){calendar.update(calendar);}  
  182. obj.onblur = function (){calendar.onblur();}  
  183. this.calendarYear = obj;  
  184. obj = this.getElementById("calendarMonth");  
  185. with(obj)  
  186. {  
  187.     onchange = function (){calendar.update(calendar);}  
  188.     onblur = function (){calendar.onblur();}  
  189. }this.calendarMonth = obj;  
  190. obj = this.getElementById("calendarHour");  
  191. with(obj)  
  192. {  
  193.     length = 0;  
  194.     for (var i = 0; i < 24; i++){  
  195.         if(i<10){options[length] = new Option("0"+i,"0"+i);}  
  196.         else{options[length] = new Option(i,i);}  
  197.     }  
  198. }this.calendarHour = obj;  
  199. obj = this.getElementById("calendarMinute");  
  200. with(obj)  
  201. {  
  202.     length = 0;  
  203.     for (var i = 0; i < 60; i++){  
  204.         if(i<10){options[length] = new Option("0"+i,"0"+i);}  
  205.         else{options[length] = new Option(i,i);}  
  206.     }  
  207. }this.calendarMinute = obj;  
  208. obj = this.getElementById("calendarSecond");  
  209. with(obj)  
  210. {  
  211.     length = 0;  
  212.     for (var i = 0; i < 60; i++){  
  213.         if(i<10){options[length] = new Option("0"+i,"0"+i);}  
  214.         else{options[length] = new Option(i,i);}  
  215.     }  
  216. }this.calendarSecond = obj;  
  217. obj = this.getElementById("calendarToday");  
  218. obj.onclick = function (){  
  219.     var today = new Date();  
  220.     calendar.date = today;  
  221.     calendar.year = today.getFullYear();  
  222.     calendar.month = today.getMonth();  
  223.     calendar.changeSelect();  
  224.     calendar.bindData();  
  225.     calendar.dateControl.value = today.format(calendar.dateFormatStyle);  
  226.     calendar.hide();  
  227. }  
  228. this.calendarToday = obj;  
  229. }  
  230. //年份下拉框绑定数据  
  231. Calendar.prototype.bindYear = function(){  
  232. var cy = this.calendarYear;  
  233. cy.length = 0;  
  234. for (var i = this.beginYear; i <= this.endYear; i++){  
  235.     cy.options[cy.length] = new Option(i + Calendar.language["year"][this.lang], i);  
  236. }  
  237. }  
  238. //月份下拉框绑定数据  
  239. Calendar.prototype.bindMonth = function(){  
  240. var cm = this.calendarMonth;  
  241. cm.length = 0;  
  242. for (var i = 0; i < 12; i++){  
  243.     cm.options[cm.length] = new Option(Calendar.language["months"][this.lang][i], i);  
  244. }  
  245. }  
  246. //获取小时的数据  
  247. Calendar.prototype.getHour = function(){  
  248. return this.calendarHour.options[this.calendarHour.selectedIndex].value;  
  249. }  
  250. //获取分钟的数据  
  251. Calendar.prototype.getMinute = function(){  
  252. return this.calendarMinute.options[this.calendarMinute.selectedIndex].value;  
  253. }  
  254. //获取秒的数据  
  255. Calendar.prototype.getSecond = function(){  
  256. return this.calendarSecond.options[this.calendarSecond.selectedIndex].value;  
  257. }  
  258. //向前一月  
  259. Calendar.prototype.goPrevMonth = function(e){  
  260. if (this.year == this.beginYear && this.month == 0){return;}  
  261. this.month--;  
  262. if (this.month == -1){  
  263.     this.year--;  
  264.     this.month = 11;  
  265. }  
  266. this.date = new Date(this.year, this.month, 1,this.getHour(),this.getMinute(),this.getSecond());  
  267. this.changeSelect();  
  268. this.bindData();  
  269. }  
  270. //向后一月  
  271. Calendar.prototype.goNextMonth = function(e){  
  272. if (this.year == this.endYear && this.month == 11){return;}  
  273. this.month++;  
  274. if (this.month == 12){  
  275.     this.year++;  
  276.     this.month = 0;  
  277. }  
  278. this.date = new Date(this.year, this.month, 1,this.getHour(),this.getMinute(),this.getSecond());  
  279. this.changeSelect();  
  280. this.bindData();  
  281. }  
  282. //改变SELECT选中状态  
  283. Calendar.prototype.changeSelect = function(){  
  284. var cy = this.calendarYear;  
  285. var cm = this.calendarMonth;  
  286. var ch = this.calendarHour;  
  287. var ci = this.calendarMinute;  
  288. var cs = this.calendarSecond;  
  289. for (var i= 0; i < cy.length; i++){  
  290.     if (cy.options[i].value == this.date.getFullYear()){  
  291.       cy[i].selected = true;  
  292.       break;  
  293.     }  
  294. }  
  295. for (var i= 0; i < cm.length; i++){  
  296.     if (cm.options[i].value == this.date.getMonth()){  
  297.       cm[i].selected = true;  
  298.       break;  
  299.     }  
  300. }  
  301. for (var i= 0; i < ch.length; i++){  
  302.     if (ch.options[i].value == this.date.getHours()){  
  303.       ch[i].selected = true;  
  304.       break;  
  305.     }  
  306. }  
  307. for (var i= 0; i < ci.length; i++){  
  308.     if (ci.options[i].value == this.date.getMinutes()){  
  309.       ci[i].selected = true;  
  310.       break;  
  311.     }  
  312. }  
  313. for (var i= 0; i < cs.length; i++){  
  314.     if (cs.options[i].value == this.date.getSeconds()){  
  315.       cs[i].selected = true;  
  316.       break;  
  317.     }  
  318. }  
  319. }  
  320. //更新年、月  
  321. Calendar.prototype.update = function (e){  
  322. this.year = e.calendarYear.options[e.calendarYear.selectedIndex].value;  
  323. this.month = e.calendarMonth.options[e.calendarMonth.selectedIndex].value;  
  324. this.date = new Date(this.year, this.month, 1,this.getHour(),this.getMinute(),this.getSecond());  
  325. this.changeSelect();  
  326. this.bindData();  
  327. }  
  328. //绑定数据到月视图  
  329. Calendar.prototype.bindData = function (){  
  330. var calendar = this;  
  331. var dateArray = this.getMonthViewArray(this.date.getFullYear(), this.date.getMonth());  
  332. var tds = this.getElementById("calendarTable").getElementsByTagName("td");  
  333. for(var i = 0; i < tds.length; i++){  
  334. tds[i].style.backgroundColor = calendar.colors["td_bg_out"];  
  335.     tds[i].onclick = function () {return;}  
  336.     tds[i].onmouseover = function () {return;}  
  337.     tds[i].onmouseout = function () {return;}  
  338.     if (i > dateArray.length - 1) break;  
  339.     tds[i].innerHTML = dateArray[i];  
  340.     if (dateArray[i] != " "){  
  341.       tds[i].onclick = function () {  
  342.         if (calendar.dateControl != null){  
  343.           calendar.dateControl.value = new Date(calendar.date.getFullYear(),  
  344.                                                 calendar.date.getMonth(),  
  345.                                                 this.innerHTML,  
  346.                                                 calendar.getHour(),  
  347.                                                 calendar.getMinute(),  
  348.                                                 calendar.getSecond()).format(calendar.dateFormatStyle);  
  349.         }  
  350.         calendar.hide();  
  351.       }  
  352.       tds[i].onmouseover = function () {  
  353.         this.style.backgroundColor = calendar.colors["td_bg_over"];  
  354.       }  
  355.       tds[i].onmouseout = function () {  
  356.         this.style.backgroundColor = calendar.colors["td_bg_out"];  
  357.       }  
  358.       if (new Date().format("yyyy-MM-dd") ==  
  359.           new Date(calendar.date.getFullYear(),  
  360.                    calendar.date.getMonth(),  
  361.                    dateArray[i]).format("yyyy-MM-dd")) {  
  362.         tds[i].style.backgroundColor = calendar.colors["cur_bg"];  
  363.         tds[i].onmouseover = function () {  
  364.           this.style.backgroundColor = calendar.colors["td_bg_over"];  
  365.         }  
  366.         tds[i].onmouseout = function () {  
  367.           this.style.backgroundColor = calendar.colors["cur_bg"];  
  368.         }  
  369.       }//end if  
  370.         
  371.       //设置已被选择的日期单元格背影色  
  372.       if (calendar.dateControl != null && calendar.dateControl.value == new Date(calendar.date.getFullYear(),  
  373.                    calendar.date.getMonth(),  
  374.                    dateArray[i],  
  375.                    calendar.getHour(),  
  376.                    calendar.getMinute(),  
  377.                    calendar.getSecond()).format(calendar.dateFormatStyle)) {  
  378.         tds[i].style.backgroundColor = calendar.colors["sel_bg"];  
  379.         tds[i].onmouseover = function () {  
  380.           this.style.backgroundColor = calendar.colors["td_bg_over"];  
  381.         }  
  382.         tds[i].onmouseout = function () {  
  383.           this.style.backgroundColor = calendar.colors["sel_bg"];  
  384.         }  
  385.       }  
  386.     }  
  387. }  
  388. }  
  389. //根据年、月得到月视图数据(数组形式)  
  390. Calendar.prototype.getMonthViewArray = function (y, m) {  
  391. var mvArray = [];  
  392. var dayOfFirstDay = new Date(y, m, 1).getDay();  
  393. var daysOfMonth = new Date(y, m + 1, 0).getDate();  
  394. for (var i = 0; i < 42; i++) {  
  395.     mvArray[i] = " ";  
  396. }  
  397. for (var i = 0; i < daysOfMonth; i++){  
  398.     mvArray[i + dayOfFirstDay] = i + 1;  
  399. }  
  400. return mvArray;  
  401. }  
  402. //扩展 document.getElementById(id) 多浏览器兼容性 from meizz tree source  
  403. Calendar.prototype.getElementById = function(id){  
  404. if (typeof(id) != "string" || id == ""return null;  
  405. if (document.getElementById) return document.getElementById(id);  
  406. if (document.all) return document.all(id);  
  407. try {return eval(id);} catch(e){ return null;}  
  408. }  
  409. //扩展 object.getElementsByTagName(tagName)  
  410. Calendar.prototype.getElementsByTagName = function(object, tagName){  
  411. if (document.getElementsByTagName) return document.getElementsByTagName(tagName);  
  412. if (document.all) return document.all.tags(tagName);  
  413. }  
  414. //取得HTML控件绝对位置  
  415. Calendar.prototype.getAbsPoint = function (e){  
  416. var x = e.offsetLeft;  
  417. var y = e.offsetTop;  
  418. while(e = e.offsetParent){  
  419.     x += e.offsetLeft;  
  420.     y += e.offsetTop;  
  421. }  
  422. return {"x": x, "y": y};  
  423. }  
  424. //显示日历  
  425. Calendar.prototype.show = function (dateObj, popControl) {  
  426. if (dateObj == null){  
  427.     throw new Error("arguments[0] is necessary")  
  428. }  
  429. this.dateControl = dateObj;  
  430. this.date = (dateObj.value.length > 0) ? new Date(dateObj.value.toDate(this.dateFormatStyle)) : new Date() ;//若为空则显示当前月份  
  431. this.year = this.date.getFullYear();  
  432. this.month = this.date.getMonth();  
  433. this.changeSelect();  
  434. this.bindData();  
  435. if (popControl == null){  
  436.     popControl = dateObj;  
  437. }  
  438. var xy = this.getAbsPoint(popControl);  
  439. this.panel.style.left = xy.x -25 + "px";  
  440. this.panel.style.top = (xy.y + dateObj.offsetHeight) + "px";  
  441. this.panel.style.display = "";  
  442. this.container.style.display = "";  
  443. dateObj.onblur = function(){calendar.onblur();}  
  444. this.container.onmouseover = function(){isFocus=true;}  
  445. this.container.onmouseout = function(){isFocus=false;}  
  446. }  
  447. //隐藏日历  
  448. Calendar.prototype.hide = function() {  
  449. this.panel.style.display = "none";  
  450. this.container.style.display = "none";  
  451. isFocus=false;  
  452. }  
  453. //焦点转移时隐藏日历  
  454. Calendar.prototype.onblur = function() {  
  455.     if(!isFocus){this.hide();}  
  456. }  
  457. document.write('<div id="ContainerPanel" style="display:none;"><div id="calendarPanel" style="position: absolute;display: none;z-index: 9999;');  
  458. document.write('background-color: #FFFFFF;border: 1px solid #CCCCCC;width:175px;font-size:12px;margin-left:25px;"></div>');  
  459. if(document.all)  
  460. {  
  461. document.write('<iframe style="position:absolute;z-index:2000;width:expression(this.previousSibling.offsetWidth);');  
  462. document.write('height:expression(this.previousSibling.offsetHeight);');  
  463. document.write('left:expression(this.previousSibling.offsetLeft);top:expression(this.previousSibling.offsetTop);');  
  464. document.write('display:expression(this.previousSibling.style.display);" scrolling="no" frameborder="no"></iframe>');  
  465. }  
  466. document.write('</div>');  
  467. //--> 
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值