EasyUI--datebox设置默认时间
1. html代码:
<input id="txtBeginTime" class="easyui-datebox" data-options="formatter:myformatter,parser:myparser"></input> <b>--</b>
<input id="txtEndTime" class="easyui-datebox" data-options="formatter:myformatter,parser:myparser"></input>
2. js代码:
function myformatter(date){
var y = date.getFullYear();
var m = date.getMonth()+1;
var d = date.getDate();
return y+'-'+(m<10?('0'+m):m)+'-'+(d<10?('0'+d):d);
}
function myparser(s){
if (!s) return new Date();
var ss = (s.split('-'));
var y = parseInt(ss[0],10);
var m = parseInt(ss[1],10);
var d = parseInt(ss[2],10);
if (!isNaN(y) && !isNaN(m) && !isNaN(d)){
return new Date(y,m-1,d);
} else {
return new Date();
}
}
//页面加载
$(function(){
//设置时间
var curr_time = new Date();
$("#txtBeginTime").datebox("setValue",myformatter(curr_time));
$("#txtEndTime").datebox("setValue",myformatter(curr_time));
//获取时间
var beginTime=$("#txtBeginTime").datebox("getValue");
var endTime=$("#txtEndTime").datebox("getValue");
});
EasyUI--datebox设置默认时间的更多相关文章
- datebox设置默认时间
1. html代码: <input id="txtBeginTime" class="easyui-datebox" data-options=" ...
- EasyUI DateTimeBox设置默认时间的注意点
- 安装xampp无法设置默认时间的坑
xampp无法设置默认时间,修改了时间还是无效 [Date] ; Defines the default timezone used by the date functions ; http://ph ...
- Sqlite 设置默认时间为本地时间
Sqlite 设置默认时间为本地时间 先设置字段类型为datetime, 再把缺省值设置为datetime( 'now', 'localtime' ) 代码查看如下 Time DATETIME DEF ...
- Mysql中设置默认时间为系统当前时间
Mysql中设置默认时间为系统当前时间 数据库设计时会遇到的一种情况:将系统当前时间设成默认值存储 数据库设计编码: CREATE TABLE `test` ( `name` varchar(50) ...
- [前端_EasyUI]给easyui的datebox设置默认值,获取不到 的解决方法
//给eayui datebox设置初始值 $("#ctime").datebox("setValue", function(){ var date = new ...
- easyui datebox 设置不可编辑
easyui datebox不允许编辑可以输入 editable="false"<input class="easyui-datebox" editabl ...
- EasyUI Combobox 设置默认值
/** *绑定运营商,设置默认值, 显示CMCC, 传值1 */ $('#operatingId').combobox({ url:'data_url', valueField:'id', textF ...
- EasyUI datetimebox设置默认值为当前时间
设置value="${notices.release_time}" <input class="easyui-validatebox easyui-datetime ...
- EasyUI datebox 设置不可编辑后再次修改为可编辑失效的解决
工作中遇到的问题,折腾了好久: 如下图: 需求:当状态发生改变后,如果状态是未核实 , 核实人 核实时间 核实结果 核实说明 均为不可编辑状态 具体js代码如下: //状态改变 $('#js ...
随机推荐
- HDU2952:Counting Sheep(DFS)
Counting Sheep Time Limit : 2000/1000ms (Java/Other) Memory Limit : 32768/32768K (Java/Other) Tota ...
- POJ 1470 Closest Common Ancestors(LCA 最近公共祖先)
其实这是一个裸求LCA的题目,我使用的是离线的Tarjan算法,但是这个题的AC对于我来说却很坎坷……首先是RE,我立马想到数组开小了,然后扩大了数组,MLE了……接着把数组调整适当大小,又交了一发, ...
- Sea.Js使用入门
1.Sea.Js是什么 seajs相对于RequireJs与LabJS就比较年轻,2010年玉伯发起了这个开源项目,SeaJS遵循CMD规范,与RequireJS类似,同样做为模块加载器.示例 // ...
- PAT (Advanced Level) 1110. Complete Binary Tree (25)
判断一棵二叉树是否完全二叉树. #include<cstdio> #include<cstring> #include<cmath> #include<vec ...
- 介绍Python程序员常用的IDE和其它开发工具
概述 “工欲善其事,必先利其器”,如果说编程是程序员的手艺,那么IDE就是程序员的吃饭家伙了. IDE 的全称是Integration Development Environment(集成开发环境), ...
- PAT1016
A long-distance telephone company charges its customers by the following rules: 一个长途电话公司费用告诉它的顾客需要遵循 ...
- 剑指offer 判断树是不是对称的
html, body { font-size: 15px; } body { font-family: Helvetica, "Hiragino Sans GB", 微软雅黑, & ...
- Jquery页面跳转
<mce:script type="text/javascript"><!-- $(function(){ var pn = $("#gotopagen ...
- Net 自定义Excel模板导出数据
转载自:http://www.cnblogs.com/jbps/p/3549671.html?utm_source=tuicool&utm_medium=referral 1 using Sy ...
- HDU1425 <sort 快排>
给你n个整数,请按从大到小的顺序输出其中前m大的数. 每组测试数据有两行,第一行有两个数n,m(0<n,m<1000000),第二行包含n个各不相同,且都处于区间[-500000,5000 ...