运行结果尺寸: 300 x 150
x
 
<!DOCTYPE html>
<html>
<body>
<p>单击该按钮可显示 UTC 时间。</p>
<button onclick="myFunction()">试一试</button>
<p id="demo"></p>
<script>
function addZero(i) {
  if (i < 10) {
    i = "0" + i;
  }
  return i;
}
function myFunction() {
  var d = new Date();
  var x = document.getElementById("demo");
  var h = addZero(d.getUTCHours());
  var m = addZero(d.getUTCMinutes());
  var s = addZero(d.getUTCSeconds());
  x.innerHTML = h + ":" + m + ":" + s;
}
</script>
</body>
</html>
×

报个问题: