日期:2014-05-16  浏览次数:20356 次

javascript时钟
function showDate() { 
var dt; 
dt = new Date(); 
var y,m,d; 
y = dt.getYear(); 
m = dt.getMonth()+1; 
d = dt.getDay(); 

var h,mi,s; 
h = dt.getHours(); 
mi = dt.getMinutes(); 
if(mi<10) 
  mi = "0"+mi; 
s = dt.getSeconds(); 
if(s<10) 
 s = "0"+s; 

var today; 
today = y + "年" + m + "月" + d + "日" + h + ":" + mi + ":" + s; 
document.getElementById("time(你所获得的Id)").innerText = today; 
setTimeout("showDate()",1000); 

}