标签:date() date text var type box input 控制 rip
<input type=‘text‘ name=‘yearQuery‘ class=‘easyui-datebox ‘ data-options="formatter:myformatter,parser:myparser" />
<javascript>
function myformatter(date){
var y = date.getFullYear();
var m = date.getMonth()+1;
var d = date.getDate();
return y;
}
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();
}
}
</javascript>
标签:date() date text var type box input 控制 rip
原文地址:http://www.cnblogs.com/kongxc/p/6193855.html