restrict.html 1.0 KB

123456789101112131415161718192021222324252627282930
  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. <input id="dd"></input>
  17. <script>
  18. $(function(){
  19. $('#dd').datebox().datebox('calendar').calendar({
  20. validator: function(date){
  21. var now = new Date();
  22. var d1 = new Date(now.getFullYear(), now.getMonth(), now.getDate());
  23. var d2 = new Date(now.getFullYear(), now.getMonth(), now.getDate()+10);
  24. return d1<=date && date<=d2;
  25. }
  26. });
  27. });
  28. </script>
  29. </body>
  30. </html>