1.主键生成:CcIDUtil.getTimeRandomId(30);
2.日期格式:DateTool.getCurren. <!--StartFragment -->
格式:yyyyMMddHHmmss
3.ajax:乱码设置:contentType:"application/x-www-form-urlencoded;charset=gbk",
js:encodeURI()
java:URLDecoder.decode(request.getParameter("task_title"),"utf-8");
4.easyui dalog窗设置:
function showDialog1() {
var top = $(document).scrollTop() + ($(window).height()-180) * 0.5;
var left = ($(window).width()-360) * 0.5;
$('#DIALOG_ID1').window('open').window('resize',{width:'360px',height:'200px',top: top,left:left});
$('#DIALOG_ID1>div>div').css("height","");
}
var top = $(document).scrollTop() + ($(window).height()-180) * 0.5;
var left = ($(window).width()-360) * 0.5;
$('#DIALOG_ID1').window('open').window('resize',{width:'360px',height:'200px',top: top,left:left});
$('#DIALOG_ID1>div>div').css("height","");
}
5.计算输入框最大长度
//计算输入框最大长度
function getStrLength(str) {
var realLength = 0, len = str.length, charCode = -1;
for ( var i = 0; i < len; i++) {
charCode = str.charCodeAt(i);
if (charCode >= 0 && charCode <= 128) {
realLength += 1;
} else {
realLength += 2;
}
}
return realLength;
}
function getStrLength(str) {
var realLength = 0, len = str.length, charCode = -1;
for ( var i = 0; i < len; i++) {
charCode = str.charCodeAt(i);
if (charCode >= 0 && charCode <= 128) {
realLength += 1;
} else {
realLength += 2;
}
}
return realLength;
}