版权声明:fromZjy QQ1045152332 https://blog.csdn.net/qq_36762677/article/details/83312342
将时间实时填入input或div
js的Date对象:http://www.w3school.com.cn/js/jsref_obj_date.asp
<script>
window.onload = function(){
function getDate(){
debugger;
var today = new Date();
var date;
date = (today.getFullYear()) +"-" + (today.getMonth() + 1 ) + "-" + today.getDate() + "-" + today.toLocaleTimeString();
return date;
}
window.setInterval(function(){
document.getElementById("getBookTime").value=getDate();
}, 1000);
}
</script>