HTML
<>table id="Ttable"><>tbody> <>tr> <>td id="Th">09<>/td><>td> : <>/td> <>td id="Tm">54<>/td><>td> : <>/td> <>td id="Ts">53<>/td> <>td id="Ap">am<>/td><>/tr> <>tr> <>td id="Dm" colspan="2">9月<>/td> <>td id="Dd" colspan="2">28日<>/td> <>td id="DD" colspan="2">星期六<>/td><>/tr> <>/tbody><>/table> <>script> function Tclock(){ var Dc = ["日","一","二","三","四","五","六"] ; var TH = new Date().getHours() ; var TM = new Date().getMinutes() ; var TS = new Date().getSeconds() ; var AmPm = (TH > 12)? "pm":"am"; TH = (TH > 12)? TH-12 :TH ; AP = (TS == 0)? 60:(TS < 10)? "0"+TS :TS; TH = (TH == 0)? 24:(TH < 10)? "0"+TH :TH ; TM = (TM == 0)? 60:(TM < 10)? "0"+TM :TM; TS = (TS == 0)? 60:(TS < 10)? "0"+TS :TS; Th.innerHTML = TH; Tm.innerHTML = TM; Ts.innerHTML = TS; Ap.innerHTML = AmPm ; Dm.innerHTML = new Date().getMonth()+1+"月"; Dd.innerHTML = new Date().getDate()+"日"; DD.innerHTML = "星期" + Dc[new Date().getDay()]; window.requestAnimationFrame(Tclock); } Tclock() ; <>/script>
沒有留言:
張貼留言