<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
<script type="text/javascript">
var attime;
function clock(){
var time=new Date();
attime= time.toLocaleTimeString() ;/*注意!本地时间*/
document.getElementById("clock").value = attime;
}
setInterval(clock,1000);/*1秒定时*/
</script>
</head>
<body>
<input type="text" id="clock" size="50" />
</body>
</html>
转载于:https://www.cnblogs.com/wjwap/p/10225075.html