JQuery日期选择器插件之date-input
官方网站:http://jonathanleighton.com/projects/date-input/
下载地址:
http://github.com/jonleighton/date_input/raw/master/jquery.date_input.js
http://github.com/jonleighton/date_input/raw/master/date_input.css
中文支持:
- jQuery.extend(DateInput.DEFAULT_OPTS, { month_names: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"], short_month_names: ["一", "二", "三", "四", "五", "六", "七", "八", "九", "十", "十一", "十二"], short_day_names: ["一", "二", "三", "四", "五", "六", "日"]});
说明:默认是日期格式很不好,可以根据需求修改。
全部代码如下:
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
- <title>日历</title>
- <script type="text/javascript" src="jquery-1.3.2.js"></script>
- <script type="text/javascript" src="jquery.date_input.js"></script>
- <link rel="stylesheet" href="date_input.css" type="text/css">
- <script>
- jQuery.extend(DateInput.DEFAULT_OPTS, {
- month_names: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
- short_month_names: ["一", "二", "三", "四", "五", "六", "七", "八", "九", "十", "十一", "十二"],
- short_day_names: ["一", "二", "三", "四", "五", "六", "日"],
- 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;
- }
- });
- $(function() {
- $(".biuuu1").date_input();
- $(".biuuu2").date_input();
- });
- </script>
- </head>
- <body>
- <input type="text" class="biuuu1" name="date"/>
- <input type="text" class="biuuu2" name="date"/>
- </body>
- </html>
示例图:
版权声明:本文为博主原创文章,未经博主允许不得转载。
Stay Hungry, Stay Foolish, Walking in Life