很简单啊,datepicker有属性设置最大日期和最小日期,选一个的事件里设置另外一个的最大最小日期就行了
创新互联公司2013年开创至今,是专业互联网技术服务公司,拥有项目做网站、成都网站建设网站策划,项目实施与项目整合能力。我们以让每一个梦想脱颖而出为使命,1280元尚义做网站,已为上家服务,为尚义各地企业和个人服务,联系电话:13518219792
$("#end_date").datepicker("option", "minDate", selectedDate);
$("#begin_date").datepicker("option", "maxDate", selectedDate);
var weekfn = new jcalendar_week({
element: "#jcalendar_week", //填充日历的dom元素
dayaddclass: function(date) {
//添加某天时给添加类名(参数:1.日期)(返回类名字符串,多个以空格分开)
return "";
},
dayclick: function(date, obj) {
//day点击事件(参数:1.日期,2.所点击DOM元素)
$(obj).addClass("calendar_day_act").siblings().removeClass("c
alendar_day_act ");
}
});
日期对象可以使用系统的内置的构造函数来创建日期对象:
var d=new Date( );
d.getYear( ); //返回年不建议使用
d.getFullYear( ); //返回年,4位数,建议使用
d.getMonth( );//返回月份,其值为0-11;
d.getDate( );//返回返回日期对象中的一个月中的第几天
d.getDay( );//返回星期几中的某一天
d.getHours( );//返回日期对象的小时部分
d.getMinutes( );//返回分钟部分
d.getSeconds( );//返回秒钟
d.getMillSeconds( );//返回毫秒
d.getTime( );//返回时间戳
d.getTimezoneOffset( );//返回时区的时差数,单位是秒
希望对你有用.
;!function(a){var b={path:"",defSkin:"",format:"YYYY-MM-DD",min:"1900-01-01 00:00:00",max:"2099-12-31 23:59:59",isv:!1},c={},d=document,e="createElement",f="getElementById",g="getElementsByTagName",h=["laydate_box","laydate_void","laydate_click","LayDateSkin","","abc.css"];a.laydate=function(b){b=b||{};try{a.event=a.event||laydate.caller.arguments[0]}catch(d){}return a.event(b.tagName=1),c.run(b),laydate},laydate.v="1.1",c.getPath=function(){var a=document.scripts,c=a[a.length-1].src;return b.path?b.path:c.substring(0,c.lastIndexOf("/")+1)}(),c.use=function(a,b){var f=d[e]("link");f.type="text/css",f.rel="stylesheet",f.href=c.getPath+a+h[5],b(f.id=b),d[g]("head")[0].appendChild(f),f=null},c.trim=function(a){return a=a||"",a.replace(/^\s|\s$/g,"").replace(/\s+/g," ")},c.digit=function(a){return 10a?"0"+(0|a):a},c.stopmp=function(b){return b=b||a.event,b.stopPropagation?b.stopPropagation():b.cancelBubble=!0,this},c.each=function(a,b){for(var c=0,d=a.length;dcb(c,a[c])!==!1;c++);},c.hasClass=function(a,b){return a=a||{},new RegExp("\\b"+b+"\\b").test(a.className)},c.addClass=function(a,b){return a=a||{},c.hasClass(a,b)||(a.className+=" "+b),a.className=c.trim(a.className),this},c.removeClass=function(a,b){if(a=a||{},c.hasClass(a,b)){var d=new RegExp("\\b"+b+"\\b");a.className=a.className.replace(d,"")}return this},c.removeCssAttr=function(a,b){var c=a.style;c.removeProperty?c.removeProperty(b):c.removeAttribute(b)},c.shde=function(a,b){a.style.display=b?"none":"block"},c.query=function(a){var e,b,h,i,j;return a=c.trim(a).split(" "),b=d[f](a[0].substr(1)),b?a[1]?/^\./.test(a[1])?(i=a[1].substr(1),j=new RegExp("\\b"+i+"\\b"),e=[],h=d.getElementsByClassName?b.getElementsByClassName(i):b[g]("*"),c.each(h,function(a,b){j.test(b.className)e.push(b)}),e[0]?e:""):(e=b[g](a[1]),e[0]?b[g](a[1]):""):b:void 0},c.on=function(b,d,e){return b.attachEvent?b.attachEvent("on"+d,function(){e.call(b,a.even)}):b.addEventListener(d,e,!1),c},c.stopMosup=function(a,b){"mouseup"!==ac.on(b,"mouseup",function(a){c.stopmp(a)})},c.run=function(a){var d,e,b=c.query;if(a.tagName){if(d=a.elem?b(a.elem):event.target||event.srcElement,!d||d===c.elem)return;c.view(d,a),c.stopMosup(event.type,d),c.reshow()}else{if(d=b(a.elem),!d)return;e=a.event||"click",c.each((0|d.length)0?d:[d],function(b,d){c.on(d,e,function(b){c.stopmp(b),d!==c.elem(c.view(d,a),c.reshow())}),c.stopMosup(e,d)})}},c.scroll=function(a){return a=a?"scrollLeft":"scrollTop",d.body[a]|d.documentElement[a]},c.winarea=function(a){return document.documentElement[a?"clientWidth":"clientHeight"]},c.isleap=function(a){return 0===a%40!==a%100||0===a%400},c.checkVoid=function(a,b,d){var e=[];return a=0|a,b=0|b,d=0|d,ac.mins[0]?e=["y"]:ac.maxs[0]?e=["y",1]:a=c.mins[0]a=c.maxs[0](a==c.mins[0](bc.mins[1]?e=["m"]:b==c.mins[1]dc.mins[2](e=["d"])),a==c.maxs[0](bc.maxs[1]?e=["m",1]:b==c.maxs[1]dc.maxs[2](e=["d",1]))),e},c.timeVoid=function(a,b){if(c.ymd[1]+1==c.mins[1]c.ymd[2]==c.mins[2]){if(0===bac.mins[3])return 1;if(1===bac.mins[4])return 1;if(2===bac.mins[5])return 1}else if(c.ymd[1]+1==c.maxs[1]c.ymd[2]==c.maxs[2]){if(0===bac.maxs[3])return 1;if(1===bac.maxs[4])return 1;if(2===bac.maxs[5])return 1}return a(b?59:23)?1:void 0},c.check=function(){var a=c.options.format.replace(/YYYY|MM|DD|hh|mm|ss/g,"\\d+\\").replace(/\\$/g,""),b=new RegExp(a),d=c.elem[h.elemv],e=d.match(/\d+/g)||[],f=c.checkVoid(e[0],e[1],e[2]);if(""!==d.replace(/\s/g,"")){if(!b.test(d))return c.elem[h.elemv]="",c.msg("日期不符合格式,请重新选择。"),1;if(f[0])return c.elem[h.elemv]="",c.msg("日期不在有效期内,请重新选择。"),1;f.value=c.elem[h.elemv].match(b).join(),e=f.value.match(/\d+/g),e[1]1?(e[1]=1,f.auto=1):e[1]12?(e[1]=12,f.auto=1):e[1].length2(f.auto=1),e[2]1?(e[2]=1,f.auto=1):e[2]c.months[(0|e[1])-1]?(e[2]=31,f.auto=1):e[2].length2(f.auto=1),e.length3(c.timeVoid(e[3],0)(f.auto=1),c.timeVoid(e[4],1)(f.auto=1),c.timeVoid(e[5],2)(f.auto=1)),f.auto?c.creation([e[0],0|e[1],0|e[2]],1):f.value!==c.elem[h.elemv](c.elem[h.elemv]=f.value)}},c.months=[31,null,31,30,31,30,31,31,30,31,30,31],c.viewDate=function(a,b,d){var f=(c.query,{}),g=new Date;a(0|c.mins[0])(a=0|c.mins[0]),a(0|c.maxs[0])(a=0|c.maxs[0]),g.setFullYear(a,b,d),f.ymd=[g.getFullYear(),g.getMonth(),g.getDate()],c.months[1]=c.isleap(f.ymd[0])?29:28,g.setFullYear(f.ymd[0],f.ymd[1],1),f.FDay=g.getDay(),f.PDay=c.months[0===b?11:b-1]-f.FDay+1,f.NDay=1,c.each(h.tds,function(a,b){var g,d=f.ymd[0],e=f.ymd[1]+1;b.className="",af.FDay?(b.innerHTML=g=a+f.PDay,c.addClass(b,"laydate_nothis"),1===e(d-=1),e=1===e?12:e-1):a=f.FDayaf.FDay+c.months[f.ymd[1]]?(b.innerHTML=g=a-f.FDay+1,a-f.FDay+1===f.ymd[2](c.addClass(b,h[2]),f.thisDay=b)):(b.innerHTML=g=f.NDay++,c.addClass(b,"laydate_nothis"),12===e(d+=1),e=12===e?1:e+1),c.checkVoid(d,e,g)[0]c.addClass(b,h[1]),c.options.festivalc.festival(b,e+"."+g),b.setAttribute("y",d),b.setAttribute("m",e),b.setAttribute("d",g),d=e=g=null}),c.valid=!c.hasClass(f.thisDay,h[1]),c.ymd=f.ymd,h.year.value=c.ymd[0]+"年",h.month.value=c.digit(c.ymd[1]+1)+"月",c.each(h.mms,function(a,b){var d=c.checkVoid(c.ymd[0],(0|b.getAttribute("m"))+1);"y"===d[0]||"m"===d[0]?c.addClass(b,h[1]):c.removeClass(b,h[1]),c.removeClass(b,h[2]),d=null}),c.addClass(h.mms[c.ymd[1]],h[2]),f.times=[0|c.inymd[3]||0,0|c.inymd[4]||0,0|c.inymd[5]||0],c.each(new Array(3),function(a){c.hmsin[a].value=c.digit(c.timeVoid(f.times[a],a)?0|c.mins[a+3]:0|f.times[a])}),c[c.valid?"removeClass":"addClass"](h.ok,h[1])},c.festival=function(a,b){var c;switch(b){case"1.1":c="元旦";break;case"3.8":c="妇女";break;case"4.5":c="清明";break;case"5.1":c="劳动";break;case"6.1":c="儿童";break;case"9.10":c="教师";break;case"10.1":c="国庆"}c(a.innerHTML=c),c=null},c.viewYears=function(a){var b=c.query,d="";c.each(new Array(14),function(b){d+=7===b?"li "+(parseInt(h.year.value)===a?'class="'+h[2]+'"':"")+' y="'+a+'"'+a+"年/li":'li y="'+(a-7+b)+'"'+(a-7+b)+"年/li"}),b("#laydate_ys").innerHTML=d,c.each(b("#laydate_ys li"),function(a,b){"y"===c.checkVoid(b.getAttribute("y"))[0]?c.addClass(b,h[1]):c.on(b,"click",function(a){c.stopmp(a).reshow(),c.viewDate(0|this.getAttribute("y"),c.ymd[1],c.ymd[2])})})},c.initDate=function(){var d=(c.query,new Date),e=c.elem[h.elemv].match(/\d+/g)||[];e.length3(e=c.options.start.match(/\d+/g)||[],e.length3(e=[d.getFullYear(),d.getMonth()+1,d.getDate()])),c.inymd=e,c.viewDate(e[0],e[1]-1,e[2])},c.iswrite=function(){var a=c.query,b={time:a("#laydate_hms")};c.shde(b.time,!c.options.istime),c.shde(h.oclear,!("isclear"in c.options?c.options.isclear:1)),c.shde(h.otoday,!("istoday"in c.options?c.options.istoday:1)),c.shde(h.ok,!("issure"in c.options?c.options.issure:1))},c.orien=function(a,b){var d,e=c.elem.getBoundingClientRect();a.style.left=e.left+(b?0:c.scroll(1))+"px",d=e.bottom+a.offsetHeight/1.5=c.winarea()?e.bottom-1:e.topa.offsetHeight/1.5?e.top-a.offsetHeight+1:c.winarea()-a.offsetHeight,a.style.top=d+(b?0:c.scroll())+"px"},c.follow=function(a){c.options.fixed?(a.style.position="fixed",c.orien(a,1)):(a.style.position="absolute",c.orien(a))},
分享标题:jquery日期选择,jQuery日期选择器
标题路径:https://www.cdcxhl.com/article36/dsdddsg.html
成都网站建设公司_创新互联,为您提供域名注册、App开发、企业建站、关键词优化、网站建设、手机网站建设
声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联