2011-01-28 100 views

回答

0

它不是真正的共同點問題。你需要一個Jquery/javascript解決方案。以下腳本將顯示網頁上的時間。如果需要,您需要按照您的間隔重新執行它以刷新它。

1: <script language="javascript"> 
    2: function getTime() { 
    3:  var dTime = new Date(); 
    4:  var hours = dTime.getHours(); 
    5:  var minute = dTime.getMinutes(); 
    6:  var period = "AM"; 
    7:  if (hours > 12) { 
    8:   period = "PM" 
    9:  } 
    10:  else { 
    11:   period = "AM"; 
    12:  } 
    13:  hours = ((hours > 12) ? hours - 12 : hours) 
    14:  return hours + ":" + minute + " " + period 
    15: } 
    16: </script> 
+0

謝謝,但我怎麼能得到它自動執行? – Rick 2011-01-28 19:57:11