标签:day timer style fun cond htm 执行 min eth
function CurrentTime() { var date = new Date(); var year = date.getFullYear(); var month = date.getMonth() + 1; var day = date.getDate(); var hour = date.getHours(); var minute = date.getMinutes(); var second = date.getSeconds(); month = month < 10 ? ("0" + month) : month; day = day < 10 ? ("0" + day) : day; hour = hour < 10 ? ("0" + hour) : hour; minute = minute < 10 ? ("0" + minute) : minute; second = second < 10 ? ("0" + second) : second; var Timer = year + ‘-‘ + month + ‘-‘ + day + ‘ ‘ + hour + ‘:‘ + minute + ‘:‘ + second; //在页面上插入日期 $("#current-time").html(Timer); setTimeout(function () { CurrentTime(); }, 1000); }
在页面内容加载完成后执行
标签:day timer style fun cond htm 执行 min eth
原文地址:https://www.cnblogs.com/leaf-blog/p/11731551.html