SOURCE

console 命令行工具 X clear

                    
>
console
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8"/>
        <meta name="viewport" content="width=device-width, initial-scale = 1.0"/>
        <title>营销活动可视化</title>
        <style></style>
    </head>
    <body>
        <header>
            <h1>Marketing Campagin Visualization</h1>
            <div class="showTime"></div>
            <script>
                var t = undefined;
                t = setTimeout(time, 1000);
                function time () {
                    clearTimeout(t);//清除定时器
                    dt = new Date();
                    var y = dt.getFullYear(),
                        mt = dt.getMonth(),
                        day = dt.getDate(),
                        h = dt.getHours(),
                        m = dt.getMinutes(),
                        s = dt.getSeconds(); 
                    document.querySelector(".showTime").innerHTML = y + "年" + mt + "月" + day + "日" +  " " + h + "时" + m + "分" + s + "秒";
                    t = setTimeout(time, 1000);//自循环刷新
                }
            </script>
        </header>
        <section class="mainbox">

        </section>
    </body>
</html>
header {
  position: relative;
  height: 1.25rem;
}
header h1 {
  font-size: 0.475rem;
  color: black;
  text-align: center;
  line-height: 1rem;
}
header .showTime {
  position: absolute;
  top: 0;
  right: 0.375rem;
  line-height: 0.9375rem;
  font-size: 0.25rem;
  color: rgba(0, 0, 0, 0.7);
}