document.write(''); document.onclick=hideCalendar; var isFirst = true; function showCalendar(contextPath,sImg,tmpA,fld1,fld2) { var cf=document.getElementById("CACalFrame"); var oImg=document.getElementById(sImg); var wcf=window.frames.CalFrame; var eT=0,eL=0,p=oImg; var sT=document.body.scrollTop,sL=document.body.scrollLeft; var eH=oImg.height+25,eW=oImg.width; cf.src = contextPath+"/js/newCalendar.htm?fld1=" + fld1 + "&fld2=" + fld2 + "&isFirst=" + isFirst; while(p&&p.tagName!="BODY"){eT+=p.offsetTop;eL+=p.offsetLeft;p=p.offsetParent;} cf.style.top=(document.body.clientHeight-(eT-sT)-eH>=cf.height)?eT+eH:eT-cf.height; cf.style.left=(document.body.clientWidth-(eL-sL)>=cf.width)?eL:eL+eW-cf.width; if(!oImg){alert("控制对象不存在!");return;} if(oImg.tagName!="INPUT"||oImg.type!="text"){alert("输入控件类型错误!");return;} cf.style.display="block"; } function hideCalendar() { var cf=document.getElementById("CACalFrame"); cf.style.display="none"; } //给页面用的不是日历控件的函数 function getNowDate() { var nowDate = new Date(); return parseDateToString(nowDate.getMonth(),nowDate.getDate(),nowDate.getYear()); } function addDate(nowDate, intDay) { nowDate.setTime(parseInt(nowDate.getTime()) + 86400000 * intDay); return parseDateToString(nowDate.getMonth(), nowDate.getDate(), nowDate.getYear()); } function parseDateToString(gMonth, gDay, gYear) { var parseDateToString; parseDateToString = gYear + "-" + fillZero(gMonth + 1) + "-" + fillZero(gDay); return parseDateToString; } function fillZero(number) { var m_int if (number < 10) m_int = '0' + number.toString(); else m_int = number.toString(); return m_int }