js 更新本地当前时间

input控件

  <%--自动更新时间--%>
    <div>
    <input type="button" value="确定" />
    <input type ="text" id="t1"  />
    </div>

js代码

  function time() {
            var q7 = document.getElementById("t1");
            var d = new Date();
            q7.value = d.toLocaleDateString()+" "+d.toLocaleTimeString();
            setInterval (time,1000)
        }
原文地址:https://www.cnblogs.com/jcdd-4041/p/3232452.html