首页 > 代码库 > 日期插件
日期插件
日期插件
<meta charset="UTF-8" /><style>*{margin:0;padding:0}#Mcalendar{width:210px;padding:5px;height:170px;border:1px solid #045bb2;display:none;cursor: pointer;}table{text-align:right;clear: both;}table th{background-color:#045bb2;width:30px;}.date div{float:left;text-align:center;height:30px;line-height:30px;}#preYear,#nextYear{width:26px}#nextMonth,#preMonth{width:23px;}#McalendarInput{margin-left:100px;margin-top:100px;}</style><script>var Class={create:function(){return function(){this.initialize.apply(this,arguments) } } }var extent=function(destination,source){for(var prop in source){ destination[prop]=source[prop]; }return destination; }function fuzhi(a){document.getElementById("McalendarInput").value=http://www.mamicode.com/a;"Mcalendar").style.display="none";document.getElementById("Mcalendar").innerHTML=""; }var Mcalendar=Class.create();Mcalendar.prototype={initialize:function(options){var $ = new Date();this.setOption(options);this.drawCalendar($.getFullYear(),$.getMonth() + 1,$.getDate(),this.options.textfield_id); },setOption:function(options){this.options={textfield_id: "Mcalendar"}extent(this.options,options||{}) },fillArray:function(year,month){var f = new Date(year, month -1 ,1).getDay();console.log(f)var arr=new Array(42);var dates = new Date(year, month , 0).getDate();console.log(dates)for(var i = 0; i < dates ; i ++ ,f ++){arr[f] =year+"-"+month+"-"+(i+1); }return arr; },getLeft:function(element){var actualLeft=element.offsetLeft;var current=element.offsetParent;if(current!=null){actualLeft+=current.offsetLeft;current=current.offsetParent; }return actualLeft; },getTop:function(element){var actualTop=element.offsetTop;var current=element.offsetParent;if(current!=null){actualTop+=current.offsetTop;current=current.offsetParent; }return actualTop; },drawCalendar:function(year,month,date,id){var $=this;var html="";html=‘ ‘;var arr=["日","一","二","三","四","五","六"];html+="<<<‘;html+=‘‘+year+‘年‘+month+‘月‘+date+‘日>>>
‘+ arr[i]+‘ | ‘; }html+=‘
---|
‘+ arr1[j].split(‘-‘)[2]+‘ | ‘; } }html+="
日期插件
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。