1.springMVC 学习点击checkbox的条目取某个值
/*slectck table的ID*/
var stationIds = "";
function change() {
var tbodyObj = document.getElementById('slectck');
$("table :checkbox").each(function(key, value) {
var stationId = tbodyObj.rows[key].cells[1].innerHTML;
if ($(value).prop('checked')) {
if(!contains(stationIds,stationId)){
stationIds+=stationId+",";
}
} else{
if(contains(stationIds,stationId)){
stationIds=stationIds.replace((stationId+","),"");
}
}
})
}
function contains(obj, ele) {
if(obj==""){
return;
}
/*若参数obj为字符串时,需要转换成数组*/
var arr = obj.split(",");
var i = arr.length;
while (i--) {
if (arr[i] == ele) {
return true;
}
}
return false;
}
2.js 通过jdbc从数据库取得getTimestamp时间进行转换成Strng
function getMyDate(str){
var oDate = new Date(str),
oYear = oDate.getFullYear(),
oMonth = oDate.getMonth()+1,
oDay = oDate.getDate(),
oHour = oDate.getHours(),
oMin = oDate.getMinutes(),
oSen = oDate.getSeconds(),
oTime = oYear +'-'+ getzf(oMonth) +'-'+ getzf(oDay) +' '+ getzf(oHour) +':'+ getzf(oMin) +':'+getzf(oSen);//最后拼接时间
return oTime;
};
//补0操作
function getzf(num){
if(parseInt(num) < 10){
num = '0'+num;
}
return num;
}