日期:2014-05-18 浏览次数:20569 次
<!-- /* 引用方法: <script language="javascript" src="../01_Common/nls-Calendar.js"></script> */ /* 调用方法: <input onfocus="calendar()" name="txt1" type="text" id="txt1" /> */ var cal_Width = 180;//定义日历显示的宽度,至少140 document.write("<div id='meizzCalendarLayer' style='position: absolute; z-index: 9999; width: " + (cal_Width+4).toString() + "px; height: 193px; display: none'>"); document.write("<iframe name='meizzCalendarIframe' scrolling='no' frameborder='0' width='100%' height='100%'></iframe></div>"); var WebCalendar = new WebCalendar(); function document.onclick() { if(WebCalendar.eventSrc != window.event.srcElement) hiddenCalendar(); } function WebCalendar() //初始化日历的设置 { //显示不下就不发了。。 } function writeIframe() { //显示不下就不发了。。 } function calendar() //主调函数 { var e = window.event.srcElement; writeIframe(); var o = WebCalendar.calendar.style; WebCalendar.eventSrc = e; if (arguments.length == 0) WebCalendar.objExport = e; else WebCalendar.objExport = eval(arguments[0]); WebCalendar.iframe.tableWeek.style.cursor = WebCalendar.drag ? "move" : "default"; var t = e.offsetTop, h = e.clientHeight, l = e.offsetLeft, p = e.type; while (e = e.offsetParent){t += e.offsetTop; l += e.offsetLeft;} o.display = ""; WebCalendar.iframe.document.body.focus(); var cw = WebCalendar.calendar.clientWidth, ch = WebCalendar.calendar.clientHeight; var dw = document.body.clientWidth, dl = document.body.scrollLeft, dt = document.body.scrollTop; if (document.body.clientHeight + dt - t - h >= ch) o.top = (p=="image")? t + h : t + h + 6; else o.top = (t - dt < ch) ? ((p=="image")? t + h : t + h + 6) : t - ch; if (dw + dl - l >= cw) o.left = l; else o.left = (dw >= cw) ? dw - cw + dl : dl; if (!WebCalendar.timeShow) WebCalendar.dateReg = /^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2})$/; else WebCalendar.dateReg = /^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2}) (\d{1,2}):(\d{1,2}):(\d{1,2})$/; try{ if (WebCalendar.objExport.value.trim() != ""){ WebCalendar.dateStyle = WebCalendar.objExport.value.trim().match(WebCalendar.dateReg); if (WebCalendar.dateStyle == null) { WebCalendar.thisYear = new Date().getFullYear(); WebCalendar.thisMonth = new Date().getMonth()+ 1; WebCalendar.thisDay = new Date().getDate(); alert("原文本框里的日期有错误!\n可能与你定义的显示时分秒有冲突!"); writeCalendar(); return false; } else { WebCalendar.thisYear = parseInt(WebCalendar.dateStyle[1], 10); WebCalendar.thisMonth = parseInt(WebCalendar.dateStyle[3], 10); WebCalendar.thisDay = parseInt(WebCalendar.dateStyle[4], 10); WebCalendar.inputDate = parseInt(WebCalendar.thisDay, 10) +"/"+ parseInt(WebCalendar.thisMonth, 10) +"/"+ parseInt(WebCalendar.thisYear, 10); writeCalendar(); } } else { WebCalendar.thisYear = new Date().getFullYear(); WebCalendar.thisMonth = new Date().getMonth()+ 1; WebCalendar.thisDay = new Date().getDate(); writeCalendar(); } } catch(e) { WebCalendar.thisYear = new Date().getFullYear(); WebCalendar.thisMonth = new Date().getMonth()+ 1; WebCalendar.thisDay = new Date().getDate(); writeCalendar(); } } function funMonthSelect() //月份的下拉框 { //显示不下就不发了。。 } function funYearSelect() //年份的下拉框 { //显示不下就不发了。。 } function prevM() //往前翻月份 { //显示不下就不