站内搜索:
首页 >> 前端 >> 内容
html页面时间实例

时间:2015/9/24 9:12:25

html页面时间实例:

 

 

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>时间</title>
</head>
<body>
<h1 id="timer"></h1>
</body>
</html>
<script>

//日期类型:date
var date = new Date();
console.log("日期类型======"+typeof date);

var timerDom = document.getElementById("timer");
setInterval(function(){
var d = new Date();
timerDom.innerHTML = d.toLocaleString();
},10);

  </script>

 


  • 上一篇:HTML-右键菜单
  • 下一篇:HTML中下拉框的简单介绍(Select)(option)
  • 返回顶部