[HTML] 纯文本查看 复制代码
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<script type="text/javascript">
function startTime()
{
var today=new Date();
var y = today.getFullYear();
var month = today.getMonth() + 1;
var d = today.getDate();
var h=today.getHours();
var m=today.getMinutes();
var s=today.getSeconds();
//不足10的情况,前面加0
month=checkTime(month);
d=checkTime(d);
m=checkTime(m);
s=checkTime(s);
document.getElementById('txt').innerHTML=y+"-"+month+"-"+d+" "+h+":"+m+":"+s
t=setTimeout('startTime()',500)
}
function checkTime(i)
{
if (i<10)
{i="0" + i}
return i
}
</script>
</head>
<body>
<div id="txt"></div>
</body>
</html>