任務(wù):
1,繼續(xù)優(yōu)化經(jīng)驗分享詳細(xì)頁面HTML
2,后臺代碼編寫,提取 經(jīng)驗的相關(guān)信息
===================================
問題一: 給DIV設(shè)置了滾動條,但AJAX提取數(shù)據(jù)寫入這個div,滾動條失效。(ajax取的是個table)
效果如下:

沒有滾動條
解決辦法:
用javascript賦予CSS值就好了。
$('#Exper_right_col').css("overflow", "auto");
$('#Exper_right_col').css("height", $("#Exper_right_col").outerHeight());
$('#Exper_right_col').css("width", $("#Exper_right_col").outerWidth());
CSS里怎么設(shè)置都沒用。。。js設(shè)置就好了。。怪事?。?!
問題二 : /Date(1463629837000)/ 如何用javascript轉(zhuǎn)換成日期?
/Date(1463629837000)/ 是oracle數(shù)據(jù)庫里取出,然后轉(zhuǎn)換成json輸送到前端。
解決方法:
<script>
var s ="/Date(1463629837000)/";
s=s.replace(/[^0-9]/ig,"");//先把里面的數(shù)字取出來
alert(s);
var date=new Date(parseInt(s)+0800);//1463629837000是一個毫秒級的timespan,+8是時區(qū)
Date.prototype.format = function(format){
var o = {
"M+" : this.getMonth()+1, //month
"d+" : this.getDate(), //day
"h+" : this.getHours(), //hour
"m+" : this.getMinutes(), //minute
"s+" : this.getSeconds(), //second
"q+" : Math.floor((this.getMonth()+3)/3), //quarter
"S" : this.getMilliseconds() //millisecond
}
if(/(y+)/.test(format)) {
format = format.replace(RegExp.$1, (this.getFullYear()+"").substr(4 - RegExp.$1.length));
}
for(var k in o) {
if(new RegExp("("+ k +")").test(format)) {
format = format.replace(RegExp.$1, RegExp.$1.length==1 ? o[k] : ("00"+ o[k]).substr((""+ o[k]).length));
}
}
return format;
}
document.write(date.format("yyyy-MM-dd hh:mm:ss"));
</script>