function timesw(_time){ var date = new Date(_time * 1000);//时间戳为10位需*1000,时间戳为13位的话不需乘1000 var Y = date.getFullYear() + '-'; var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-'; var D = date.getDate() + ' '; var h = date.getHours() + ':'; var m = date.getMinutes(); var s = date.getSeconds(); return Y + M + D + h + m; } $(function(){ var datas; $.post("http://article.yuxiit.com/Home/Article/articleList.html",{p1_Num: 10}).done(function(res){ if(res.code == '10000'){ datas = res.data; } }); setTimeout(function(){ // console.log(datas); for (var i = 0; i < datas.length; i++) { $('.firstPageBox3Li .cBlue').eq(i).html(datas[i].name); for ( var j = 0; j < datas[i].articleList.length; j++) { var _html = '
  • ' + '' + '' + '' + timesw(datas[i].articleList[j].time) + '' + '' + datas[i].articleList[j].title + ''+ '
    ' + '
    ' + '
  • ' $('.firstPageBox3Li').eq(i).children('ul').append(_html); } }; },1000) });