Sin descripción

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
  5. <link rel="stylesheet" type="text/css" href="./jquery.datetimepicker.css"/>
  6. <style type="text/css">
  7. .custom-date-style {
  8. background-color: red !important;
  9. }
  10. </style>
  11. </head>
  12. <body>
  13. <p><a href="http://xdsoft.net/jqplugins/datetimepicker/">Homepage</a></p>
  14. <h3>DateTimePicker</h3>
  15. <input type="text" value="" id="datetimepicker"/><br><br>
  16. <h3>DateTimePickers selected by class</h3>
  17. <input type="text" class="some_class" value="" id="some_class_1"/>
  18. <input type="text" class="some_class" value="" id="some_class_2"/>
  19. <h3>Mask DateTimePicker</h3>
  20. <input type="text" value="" id="datetimepicker_mask"/><br><br>
  21. <h3>TimePicker</h3>
  22. <input type="text" id="datetimepicker1"/><br><br>
  23. <h3>DatePicker</h3>
  24. <input type="text" id="datetimepicker2"/><br><br>
  25. <h3>Inline DateTimePicker</h3>
  26. <!--<div id="console" style="background-color:#fff;color:red">sdfdsfsdf</div>-->
  27. <input type="text" id="datetimepicker3"/><input type="button" onclick="$('#datetimepicker3').datetimepicker({value:'2011/12/11 12:00'})" value="set inline value 2011/12/11 12:00"/><br><br>
  28. <h3>Button Trigger</h3>
  29. <input type="text" value="2013/12/03 18:00" id="datetimepicker4"/><input id="open" type="button" value="open"/><input id="close" type="button" value="close"/><input id="reset" type="button" value="reset"/>
  30. <h3>TimePicker allows time</h3>
  31. <input type="text" id="datetimepicker5"/><br><br>
  32. <h3>Destroy DateTimePicker</h3>
  33. <input type="text" id="datetimepicker6"/><input id="destroy" type="button" value="destroy"/>
  34. <h3>Set options runtime DateTimePicker</h3>
  35. <input type="text" id="datetimepicker7"/>
  36. <p>If select day is Saturday, the minimum set 11:00, otherwise 8:00</p>
  37. <h3>onGenerate</h3>
  38. <input type="text" id="datetimepicker8"/>
  39. <h3>disable all weekend</h3>
  40. <input type="text" id="datetimepicker9"/>
  41. <h3>Default date and time </h3>
  42. <input type="text" id="default_datetimepicker"/>
  43. <h3>Show inline</h3>
  44. <a href="javascript:void(0)" onclick="var si = document.getElementById('show_inline').style; si.display = (si.display=='none')?'block':'none';return false; ">Show/Hide</a>
  45. <div id="show_inline" style="display:none">
  46. <input type="text" id="datetimepicker10"/>
  47. </div>
  48. <h3>Disable Specific Dates</h3>
  49. <p>Disable the dates 2 days from now.</p>
  50. <input type="text" id="datetimepicker11"/>
  51. <h3>Custom Date Styling</h3>
  52. <p>Make the background of the date 2 days from now bright red.</p>
  53. <input type="text" id="datetimepicker12"/>
  54. <h3>Dark theme</h3>
  55. <p>thank for this <a href="https://github.com/lampslave">https://github.com/lampslave</a></p>
  56. <input type="text" id="datetimepicker_dark"/>
  57. </body>
  58. <script src="./jquery.js"></script>
  59. <script src="./jquery.datetimepicker.js"></script>
  60. <script>/*
  61. window.onerror = function(errorMsg) {
  62. $('#console').html($('#console').html()+'<br>'+errorMsg)
  63. }*/
  64. $('#datetimepicker').datetimepicker({
  65. dayOfWeekStart : 1,
  66. lang:'en',
  67. disabledDates:['1986/01/08','1986/01/09','1986/01/10'],
  68. startDate: '1986/01/05'
  69. });
  70. $('#datetimepicker').datetimepicker({value:'2015/04/15 05:03',step:10});
  71. $('.some_class').datetimepicker();
  72. $('#default_datetimepicker').datetimepicker({
  73. formatTime:'H:i',
  74. formatDate:'d.m.Y',
  75. //defaultDate:'8.12.1986', // it's my birthday
  76. defaultDate:'+03.01.1970', // it's my birthday
  77. defaultTime:'10:00',
  78. timepickerScrollbar:false
  79. });
  80. $('#datetimepicker10').datetimepicker({
  81. step:5,
  82. inline:true
  83. });
  84. $('#datetimepicker_mask').datetimepicker({
  85. mask:'9999/19/39 29:59'
  86. });
  87. $('#datetimepicker1').datetimepicker({
  88. datepicker:false,
  89. format:'H:i',
  90. step:5
  91. });
  92. $('#datetimepicker2').datetimepicker({
  93. yearOffset:222,
  94. lang:'ch',
  95. timepicker:false,
  96. format:'d/m/Y',
  97. formatDate:'Y/m/d',
  98. minDate:'-1970/01/02', // yesterday is minimum date
  99. maxDate:'+1970/01/02' // and tommorow is maximum date calendar
  100. });
  101. $('#datetimepicker3').datetimepicker({
  102. inline:true
  103. });
  104. $('#datetimepicker4').datetimepicker();
  105. $('#open').click(function(){
  106. $('#datetimepicker4').datetimepicker('show');
  107. });
  108. $('#close').click(function(){
  109. $('#datetimepicker4').datetimepicker('hide');
  110. });
  111. $('#reset').click(function(){
  112. $('#datetimepicker4').datetimepicker('reset');
  113. });
  114. $('#datetimepicker5').datetimepicker({
  115. datepicker:false,
  116. allowTimes:['12:00','13:00','15:00','17:00','17:05','17:20','19:00','20:00'],
  117. step:5
  118. });
  119. $('#datetimepicker6').datetimepicker();
  120. $('#destroy').click(function(){
  121. if( $('#datetimepicker6').data('xdsoft_datetimepicker') ){
  122. $('#datetimepicker6').datetimepicker('destroy');
  123. this.value = 'create';
  124. }else{
  125. $('#datetimepicker6').datetimepicker();
  126. this.value = 'destroy';
  127. }
  128. });
  129. var logic = function( currentDateTime ){
  130. if (currentDateTime && currentDateTime.getDay() == 6){
  131. this.setOptions({
  132. minTime:'11:00'
  133. });
  134. }else
  135. this.setOptions({
  136. minTime:'8:00'
  137. });
  138. };
  139. $('#datetimepicker7').datetimepicker({
  140. onChangeDateTime:logic,
  141. onShow:logic
  142. });
  143. $('#datetimepicker8').datetimepicker({
  144. onGenerate:function( ct ){
  145. $(this).find('.xdsoft_date')
  146. .toggleClass('xdsoft_disabled');
  147. },
  148. minDate:'-1970/01/2',
  149. maxDate:'+1970/01/2',
  150. timepicker:false
  151. });
  152. $('#datetimepicker9').datetimepicker({
  153. onGenerate:function( ct ){
  154. $(this).find('.xdsoft_date.xdsoft_weekend')
  155. .addClass('xdsoft_disabled');
  156. },
  157. weekends:['01.01.2014','02.01.2014','03.01.2014','04.01.2014','05.01.2014','06.01.2014'],
  158. timepicker:false
  159. });
  160. var dateToDisable = new Date();
  161. dateToDisable.setDate(dateToDisable.getDate() + 2);
  162. $('#datetimepicker11').datetimepicker({
  163. beforeShowDay: function(date) {
  164. if (date.getMonth() == dateToDisable.getMonth() && date.getDate() == dateToDisable.getDate()) {
  165. return [false, ""]
  166. }
  167. return [true, ""];
  168. }
  169. });
  170. $('#datetimepicker12').datetimepicker({
  171. beforeShowDay: function(date) {
  172. if (date.getMonth() == dateToDisable.getMonth() && date.getDate() == dateToDisable.getDate()) {
  173. return [true, "custom-date-style"];
  174. }
  175. return [true, ""];
  176. }
  177. });
  178. $('#datetimepicker_dark').datetimepicker({theme:'dark'})
  179. </script>
  180. </html>