restrict.html 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>Restrict Date Range in DateBox - jQuery EasyUI Demo</title>
  6. <link rel="stylesheet" type="text/css" href="../../themes/default/easyui.css">
  7. <link rel="stylesheet" type="text/css" href="../../themes/icon.css">
  8. <link rel="stylesheet" type="text/css" href="../demo.css">
  9. <script type="text/javascript" src="../../jquery.min.js"></script>
  10. <script type="text/javascript" src="../../jquery.easyui.min.js"></script>
  11. </head>
  12. <body>
  13. <h2>Restrict Date Range in DateBox</h2>
  14. <p>This example shows how to restrict the user to select only ten days from now.</p>
  15. <div style="margin:20px 0;"></div>
  16. <div class="easyui-panel" style="width:100%;max-width:400px;padding:30px 60px;">
  17. <div style="margin-bottom:20px">
  18. <input id="dd" label="Select Date:" labelPosition="top" style="width:100%;">
  19. </div>
  20. </div>
  21. <script>
  22. $(function(){
  23. $('#dd').datebox().datebox('calendar').calendar({
  24. validator: function(date){
  25. var now = new Date();
  26. var d1 = new Date(now.getFullYear(), now.getMonth(), now.getDate());
  27. var d2 = new Date(now.getFullYear(), now.getMonth(), now.getDate()+10);
  28. return d1<=date && date<=d2;
  29. }
  30. });
  31. });
  32. </script>
  33. </body>
  34. </html>