点击这里查看效果http://keleyi.com/keleyi/phtml/jstexiao/10.htm
以下式代码:
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 5 <title>js快捷输入日期-柯乐义</title> 6 <style> 7 div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6, pre, code, form, fieldset, legend, input, textarea, p, blockquote, th, td, em, button { 8 margin: 0; 9 padding: 0; 10 } 11 body { 12 color: #333333; 13 font-family: Simsun,sans-serif; 14 font-size: 12px; 15 line-height: 1.5; 16 } 17 </style> 18 </head> 19 <body> 20 <table width="300" align="center" > 21 <tr> 22 <td height="100" valign="middle"><strong>日期选择控件:</strong></td> 23 <td width="30"></td> 24 <td valign="middle"><input id="calendar" type="text"></td> 25 </tr> 26 </table> 27 <div style="width:736px;margin:0px auto;"><a href="http://keleyi.com/a/bjad/tw09x2nt.htm" target="_blank">原文</a></div> 28 <script src="http://keleyi.com/keleyi/phtml/jstexiao/10/cQuery_110421.js" charset="utf-8" type="text/javascript"></script> 29 <script src="http://keleyi.com/keleyi/phtml/jstexiao/10/js/calendar.js" charset="utf-8" type="text/javascript"></script> 30 <script type="text/javascript"> 31 32 $("#calendar").regMod("calendar","6.0", { 33 options: { 34 autoShow: !1, 35 showWeek: !0, 36 maxDate: function() { 37 var a = (new Date).addYears(1); 38 return a.getFullYear() + "-" + (a.getMonth() + 1) + "-" + a.getDate() 39 }() 40 }, 41 listeners:{ 42 onBeforeShow: function() {}, 43 onChange: function() {} 44 } 45 }) 46 </script> 47 48 </body> 49 </html>