<script type="text/javascript">
//Date new Date()
window.onload=function((){
setInterval(function(){
var time=new Date()//获取的是当前事件 console.log(time)
var year =time.getfullYear()//年份
var month=time.getMonth()+1//月份0-11 var date=time.getDate()//日
var hours=time.getHours()//小时
var minutes=time.getMinutes()//分钟 var seconds=time.getseconds()//秒数 month=month>9?month:"0"+month date=date>9?date:"0"+date
hours=hours>9?hours:"0"+hours
minutes=minutes>9?minutes:"0"+minutes seconds=seconds>9?seconds:"0"+seconds
var result =year+"年"+month+"月"+date+"日"+hours+":"+minutes+":"+seconds//document.write(result)
document.getElementById("result").innerHTML=result},1000)//1000亳秒是1秒