第一个 jquery 日期选择插件 Date Input
插件主页 http://jonathanleighton.com/projects/date-input
是老外开发的所以用时 要稍微修改一下源码 下载下来后打开jquery.date_input.js
首先修改显示
找到
jQuery.extend(DateInput.DEFAULT_OPTS, { month_names: ["Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"], short_month_names: ["Ene", "Feb", "Mar", "Abr", "May", "Jun", "Jul", "Ago", "Sep", "Oct", "Nov", "Dic"], short_day_names: ["Dom", "Lun", "Mar", "Mié", "Jue", "Vie", "Sab"] })
将其替换为
DateInput.DEFAULT_OPTS = {
month_names: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
short_month_names: ["一", "二", "三", "四", "五", "六", "七", "八", "九", "十", "十一", "十二"],
short_day_names: ["一", "二", "三", "四", "五", "六", "日"],
start_of_week: 1
};
然后修改日期格式日期的格式化由如下两个方法完成:stringToDate, 传入一个字符串,返回一个Javascript Date对象,dateToString 传入一个Javascript对象并返回一个字符串。你可以替换这两个函数使日期的格式不同。例如,下面的函数返回的日期格式为: YYYY-MM-DD。
找到
将其修改为:
var matches;
if (matches = string.match( / ^(\d{4,4})-(\d{2,2})-(\d{2,2})$ / )) {
return new Date(matches[ 1 ], matches[ 2 ] - 1 , matches[ 3 ]);
} else {
return null ;
};
},
dateToString: function (date) {
var month = (date.getMonth() + 1 ).toString();
var dom = date.getDate().toString();
if (month.length == 1 ) month = " 0 " + month;
if (dom.length == 1 ) dom = " 0 " + dom;
return date.getFullYear() + " - " + month + " - " + dom;
},
这样局i可以了。
第二个 jquery 分页插件 pagination
allpage, //总条目数
{
num_edge_entries: 2 ,//两侧显示的首尾分页的条目数
num_display_entries: 4 ,//连续分页主体部分显示的分页条目数
callback: pageselectCallback,//点击页码时回调函数
items_per_page: 1//每页显示的条目数
}
);
第三个 jquery 图片插件
MobilySelect
MobilySelect is jQuery plugin (2kB) that replaces one collection of items with another.var matches;
if (matches = string.match( / ^(\d{1,2}) ([^\s]+) (\d{4,4})$ / )) {
return new Date(matches[ 3 ], this .shortMonthNum(matches[ 2 ]), matches[ 1 ], 12 , 00 );
} else {
return null ;
};
},
dateToString: function (date) {
return date.getDate() + " " + this .short_month_names[date.getMonth()] + " " + date.getFullYear();
},
setPosition: function () {
var offset = this .input.offset();
this .rootLayers.css({
top: offset.top + this .input.outerHeight(),
left: offset.left
});