index.html 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  6. <meta name="viewport" content="width=device-width, initial-scale=1">
  7. <title>Datepicker日期选择器插件 | jQuery日历</title>
  8. <!-- <link rel="stylesheet" href="http://www.jq22.com/jquery/font-awesome.4.6.0.css"> -->
  9. <link href="css/foundation.min.css" rel="stylesheet" type="text/css">
  10. <link href="css/foundation-datepicker.css" rel="stylesheet" type="text/css">
  11. <style>
  12. .container {
  13. margin: 0 auto;
  14. max-width: 960px;
  15. padding: 20px;
  16. }
  17. </style>
  18. </head>
  19. <body>
  20. <div class="container">
  21. <h1>Datepicker日期选择器插件</h1>
  22. <h2>Datepicker</h2>
  23. <input type="text" value="" id="demo-1">
  24. <h2>With timepicker</h2>
  25. <input type="text" value="" id="demo-2">
  26. <h2>Month picker</h2>
  27. <div class="row collapse date" id="demo-3" data-date="07/2015" data-format="mm/yyyy" data-start-view="year" data-min-view="year">
  28. <div class="small-2 columns"> <span class="prefix"><i class="fa fa-calendar"></i></span> </div>
  29. <div class="small-10 columns">
  30. <input size="16" type="text" value="07/2015" readonly>
  31. </div>
  32. </div>
  33. <h2>Dependent datepicker</h2>
  34. <input type="text" class="span2" value="" id="dpd1">
  35. <input type="text" class="span2" value="" id="dpd2">
  36. <!-- <table class="table">
  37. <thead>
  38. <tr>
  39. <th>Check in:
  40. <input type="text" class="span2" value="" id="dpd1">
  41. </th>
  42. <th>Check out:
  43. <input type="text" class="span2" value="" id="dpd2">
  44. </th>
  45. </tr>
  46. </thead>
  47. </table> -->
  48. </div>
  49. <script src="js/jquery-1.11.3.min.js"></script>
  50. <script src="js/foundation-datepicker.js"></script>
  51. <script src="js/locales/foundation-datepicker.zh-CN.js"></script>
  52. <script>
  53. $('#demo-1').fdatepicker();
  54. $('#demo-2').fdatepicker({
  55. format: 'yyyy-mm-dd hh:ii',
  56. pickTime: true
  57. });
  58. $('#demo-3').fdatepicker();
  59. var nowTemp = new Date();
  60. var now = new Date(nowTemp.getFullYear(), nowTemp.getMonth(), nowTemp.getDate(), 0, 0, 0, 0);
  61. var checkin = $('#dpd1').fdatepicker({
  62. format: 'yyyy-mm-dd hh:ii:ss',
  63. pickTime: true,
  64. onRender: function(date) {
  65. return date.valueOf() < now.valueOf() ? 'disabled' : '';
  66. }
  67. }).data('datepicker');
  68. var checkout = $('#dpd2').fdatepicker({
  69. onRender: function(date) {
  70. return date.valueOf() <= checkin.date.valueOf() ? 'disabled' : '';
  71. }
  72. }).on('changeDate', function(ev) {
  73. checkout.hide();
  74. }).data('datepicker');
  75. </script>
  76. </body>
  77. </html>