//将秒转化为时间戳 function timestampToTime(seconds){ var date = new Date(seconds*1000) var year = date.getFullYear(); var month = date.getMonth() + 1; var day = date.getDate(); var currentTime = year + "-" + month + "-" + day ; return currentTime } //过滤字符串中所有html标签 function filterHTMLTag(str) { str = str.replace(/<\/?[^>]*>/g, ''); //去除HTML tag str = str.replace(/[ | ]*\n/g, '\n'); //去除行尾空白 str = str.replace(/ /ig, ''); //去掉 return str; }