设置easyUI的日历选择范围
来源:互联网 发布:渗透理论 复杂网络 编辑:程序博客网 时间:2024/06/05 21:55
在使用easyUI的日历插件时,不加以设置的话日历上的每一天都可以选择,最近工作需要规定当天以前的日期是不能被选择~其实不难哦~我向来比较爽快,没那么多文字,直接上代码,不懂的可以问我,估计大家一看就懂,嘻嘻(^__^) 嘻嘻……
<!DOCTYPE html><html><head> <meta charset="utf-8"> <title>设置日历选择范围</title> <link rel="stylesheet" type="text/css" href="jquery-easyui-1.4.2/themes/default/easyui.css"/> <link rel="stylesheet" type="text/css" href="jquery-easyui-1.4.2/themes/icon.css"/> <style type="text/css"> .calendarBox{ width: 500px; height: 500px; background-color: #ccc; margin: auto; } </style></head><body> <div class="calendarBox"> <div id="calendar"></div> <input id="dateBox" class="easyui-datebox" name="dateBox" required> </div> <script type="text/javascript" src="jquery-1.4.4.min.js"></script> <script type="text/javascript" src="jquery-easyui-1.4.2/jquery.easyui.min.js"></script> <script type="text/javascript"> $("#calendar").calendar({ validator: function(date){ var now = new Date(); var d1 = new Date(now.getFullYear(), now.getMonth(), now.getDate()); return d1<=date; }, current:new Date(), onSelect: function(date){ //alert(date.getFullYear()+"-"+(date.getMonth()+1)+"-"+date.getDate()); if((date.getMonth()+1)<10){ mTDate = date.getFullYear()+"-0"+(date.getMonth()+1)+"-"+date.getDate(); alert(mTDate); }else{ mTDate = date.getFullYear()+"-"+(date.getMonth()+1)+"-"+date.getDate(); alert(mTDate); } } }); //easyui-datebox $("#dateBox").datebox().datebox('calendar').calendar({ validator: function(date){ var now = new Date(); var d1 = new Date(now.getFullYear(), now.getMonth(), now.getDate()); return d1<=date; } }); $("#dateBox").datebox({ onSelect: function(date){ // alert(now.getFullYear(), now.getMonth(), now.getDate()); alert(date); } }); </script></body></html>
效果如下:
当天之前的日期都是不能被选中的
0 0
- 设置easyUI的日历选择范围
- easyui的datebox设置时间范围和日期格式
- 设置日期选择组件(DateField )的选择范围
- 设置日期选择组件(DateField )的选择范围
- 设置日期选择组件(DateField )的选择范围
- 快速设置面选择控件的选择范围
- easyui-datebox限制选择日期范围
- iOS 设置searchBar下面的范围选择框
- Easyui Datebox设置可选时间范围
- Easyui Datebox设置可选时间范围
- easyui的datebox限定范围
- 日期范围选择类日历(增强版)
- EasyUI 日历
- EBS form日历可选范围设置(calendar.setup )介绍
- jQuery easyui 日历控件的用法:
- 坐标轴范围的设置
- easyUI日期框的日期范围限制
- easyui-datebox 设置只选择月份
- linux中shell变量$#,$@,$0,$1,$2的含义解释
- hibernate HQL学习笔记
- docker常用问题
- ubuntu-常用的重要目录、文件
- log4j配置文件
- 设置easyUI的日历选择范围
- Linux命令行与shell脚本(16)--gawk使用
- 微信JSSDK拍照选择图片API在IOS中图片不显示问题
- Android Studio插件推荐
- docker run 中的privileged参数
- 各种排序算法性能比较。
- android学习网站整理
- Mybatis的Helloworld
- 视图