基于Firefx浏览器与IE浏览器的通用型日历控件.docx

基于Firefx浏览器与IE浏览器的通用型日历控件.docx

  1. 1、本文档共19页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
基于Firefx浏览器与IE浏览器的通用型日历控件

基于Firefox/IE浏览器的日历控件 程序是以脚本之家流行的基于IE浏览器的Calendar.js程序为模板,经多人修改完善,现支持多版本浏览器,需要两个文件WebCalendar.js与WebCalendar.html具体代码如下WebCalendar.js/***----------------------------基于IE/Firefox浏览器------------------------------*/varcal;varisFocus=false;//是否为焦点varpickMode={second:1,minute:2,hour:3,day:4,month:5,year:6};vartopY=0,leftX=0;//自定义定位偏移量//选择日期→通过ID来选日期functionSelectDateById(id,strFormat,x,y){varobj=document.getElementById(id);if(obj==null){returnfalse;}obj.focus();if(obj.onclick!=null){obj.onclick();}elseif(obj.click!=null){obj.click();}else{SelectDate(obj,strFormat,x,y)}}//选择日期functionSelectDate(obj,strFormat,x,y){leftX=(x==null)?leftX:x;topY=(y==null)?topY:y;//自定义定位偏移量if(document.getElementById(ContainerPanel)==null){InitContainerPanel();}vardate=newDate();varby=date.getFullYear()-50;//最小值→50年前varey=date.getFullYear()+50;//最大值→50年后//cal=newCalendar(by,ey,1,strFormat);//初始化英文版,0为中文版cal=(cal==null)?newCalendar(by,ey,0):cal;//不用每次都初始化cal.DateMode=pickMode[second];//复位if(strFormat.indexOf(s)0){cal.DateMode=pickMode[minute];}//精度为分if(strFormat.indexOf(m)0){cal.DateMode=pickMode[hour];}//精度为时if(strFormat.indexOf(h)0){cal.DateMode=pickMode[day];}//精度为日if(strFormat.indexOf(d)0){cal.DateMode=pickMode[month];}//精度为月if(strFormat.indexOf(M)0){cal.DateMode=pickMode[year];}//精度为年if(strFormat.indexOf(y)0){cal.DateMode=pickMode[second];}//默认精度为秒cal.dateFormatStyleOld=cal.dateFormatStyle;cal.dateFormatStyle=strFormat;cal.show(obj);}/**//**//**//**//**//**//**//***返回日期*@paramdthedelimiter*@parampthepatternofyourdate根据用户指定的style来确定;*/Stotype.toDate=function(style){vary=this.substring(style.indexOf(y),style.lastIndexOf(y)+1);//年varM=this.substring(style.indexOf(M),style.lastIndexOf(M)+1);//月vard=this.substring(style.indexOf(d),style.lastIndexOf(d)+1);//日varh=this.substring(style.indexOf(h),style.lastIndexOf(h)+1);//时varm=this.substring(style.indexOf(m),style.lastIndexOf(m)+1);//分vars=this.substring(style.indexOf(s),style.lastIndexOf(s)+1);//秒if(s==null||s==||isNaN(s)){s=newDate().getSeconds()

文档评论(0)

bendaoganqunlia + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档