setInterval(function(){ var dd = new Date(); var y = dd.getFullYear(); var m = dd.getMonth() + 1; var d = dd.getDate(); var h = dd.getHours(); var mi = dd.getMinutes(); var s = dd.getSeconds(); var str = y + "年" + m + "月" + d + "日 " + h + ":" + mi + ":" + s + " 星期" + "日一二三四五六".charAt(dd.getDay()); document.getElementById("dom").innerHTML = str;},1000);