官網:http://jonathanleighton.com/projects/date-input/
下載:
http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js
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>