<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style>
.lala{
text-align: center;
}
</style>
</head>
<body>
<div class="lala">
<input type="button" value="当前时间" onclick="anniu()"/ style="width: 80px;height: 20px;" >
<input type="text" id="xi"/>
<script>
setInterval(function anniu(){
var oDate = new Date();
var oyear=oDate.getFullYear();
var month=oDate.getMonth()+1;
var day=oDate.getDate();
var hours=oDate.getHours();
var minutes=oDate.getMinutes();
var seconds=oDate.getSeconds();
document.getElementById("xi").value=oyear+"年"+month+"月"+day+"日"+hours+"时"+minutes+"分"+seconds+"秒"
},1000);
</script>
</div>
</body>
</html>