一下是jquery代码,需要引用核心js文件
代码如下
function showTime(){ var date = new Date(); var year = date.getFullYear(); var month = date.getMonth(); var ri = date.getDate(); var xingqi = date.getDay(); let xq = ['日','一','二','三','四','五','六']; var hours = date.getHours(); var minutes = date.getMinutes(); var minutes = minutes < 10 ? '0'+minutes : minutes; var seconds = date.getSeconds(); var time = year + '年' + (month+1) + '月' + ri + '日 ' + '星期' + xq[xingqi] + " " + hours + ":" + minutes + ":" + seconds; $("#time").html(time); } setInterval(showTime, 1000);
技术QQ交流群:157711366
技术微信:liehuweb
写评论