结果显示为什么是标准时间格式和时分秒格式交替出现?
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>定时器</title>
<script type="text/javascript">
var attime;
function clock(){
var time=new Date();
attime=time.getHours()+":"+time.getMinutes()+":"+time.getSeconds() ;
document.getElementById("clock").value = attime;
}
var int=setInterval(clock,2000) ;
</script>
</head>
<body>
<form>
<input type="text" id="clock" size="50" />
</form>
</body>
</html>
结果显示,先是显示:Sat Aug 04 2018 17:27:19 GMT+0800 (中国标准时间)
再显示:17:27:19