﻿function setTime()
{ 
 var day=""; 
 var month=""; 
 var ampm=""; 
 var ampmhour=""; 
 var myweekday=""; 
 var year=""; 
 var myHours=""; 
 var myMinutes=""; 
 var mySeconds=""; 
 mydate=new Date(); 
 myweekday=mydate.getDay(); 
 mymonth=parseInt(mydate.getMonth()+1)<10?"0"+(mydate.getMonth()+1):mydate.getMonth()+1; 
 myday= mydate.getDate(); 
 myyear= mydate.getYear(); 
 myHours = mydate.getHours(); 
 myMinutes = mydate.getMinutes(); 
 mySeconds = parseInt(mydate.getSeconds())<10?"0"+mydate.getSeconds():mydate.getSeconds(); 
 year=(myyear > 200) ? myyear : 1900 + myyear; 
 datetime.innerText="当前时间是："+year+"年"+mymonth+"月"+myday+"日 "+myHours+":"+myMinutes+":"+mySeconds; 
 setTimeout("setTime()",1000); 
} 
setTime();
