倒數計時   Javascript count down
<script type='text/javascript'>
 // 設定倒數日期
var countDownDate = new Date("Jan 1,
2023 00:00:00").getTime();
 // 每秒更新1次
var x = setInterval(function() {
   // 取得今天的日期及時間
  var
now = new Date().getTime();
   // 取得現在與倒數日期的間隔
  var
distance = countDownDate - now;
   // 計算
  var
days = Math.floor(distance / (1000 * 60 * 60 * 24));
  var
hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
  var
minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
  var
seconds = Math.floor((distance % (1000 * 60)) / 1000);
   // 在 id="endSemester"顯示結果
  document.getElementById("endSemester").innerHTML
= days + "天 " + hours + "小時 "
  +
minutes + "分鐘 " + seconds + "秒 ";
   // 倒數結束輸出
  if
(distance < 0) {
   
clearInterval(x);
   
document.getElementById("endSemester").innerHTML =
"新年快樂 ^_^";
  }
}, 1000);
 </script>
 <h3>Time to end of semester.<p
id="endSemester"></p></h3>
 距離 2023 年