<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
</head>
<body>
<!--<input type="button" value="显示当前时间" onclick="myDate()"/>-->
<div id="div" style="width: 200px; height: 30px;"></div>
</body>
<script>
var i=0;
function myDate(){
var now=new Date();
var year=now.getFullYear();
var month=now.getMonth()+1;
var day=now.getDate();
var hours=now.getHours();
var minutes=now.getMinutes();
var seconds=now.getSeconds();
document.getElementById("div").innerHTML=year+"年"+month+"月"+day+"日"+hours+":"+minutes+":"+seconds;
}
setInterval(myDate,1000);
</script>
</html>
打开App,阅读手记