<p id="currentTime">
</p>
<script>
document.getElementById("currentTime").innerhtml = new Date();//初始化时间
var timing = setInterval(function(){changeTime()},1000);//设置定时执行方法和执行频率
function changeTime(){
document.getElementById("currentTime").innerHTML = new Date();//改变内容
console.log(new Date());//像控制台打印内容
}
</script>