华为太空表网站源码

<html>
<head>
    <title>太空人表盘</title>
    <meta charset="UTF-8">
    <link href="./assets/css/style.css" rel="stylesheet">
    <script src="./assets/js/timeGeneration.js"></script>
</head>
<body>
<div class="jun-meter">
    <div class="jun-time-h-h" id="hh"></div>
    <div class="jun-time-h-l" id="hl"></div>
    <div class="jun-time-rect"></div>
    <div class="jun-human"></div>
    <div class="jun-time-m-h" id="mh"></div>
    <div class="jun-time-m-l" id="ml"></div>
    <div class="jun-time-s-h" id="sh"></div>
    <div class="jun-time-s-l" id="sl"></div>
    <div class="jun-date" id="date"></div>
    <div class="jun-calendar-date" id="calendarDate"></div>
</div>
</body>

<script>

    function WatchMeter() {
        // 初始化dom
        this._initDom()
        // 更新
        this.update()

        this.date = new TimeGeneration()

    }

    // 修改原型
    WatchMeter.prototype = {
        constructor: WatchMeter,
        // 初始化Dom
        _initDom: function () {
            this.elem = {}
            this.elem.hh = document.getElementById('hh')
            this.elem.hl = document.getElementById('hl')
            this.elem.mh = document.getElementById('mh')
            this.elem.ml = document.getElementById('ml')
            this.elem.sh = document.getElementById('sh')
            this.elem.sl = document.getElementById('sl')
            this.elem.date = document.getElementById('date')
            this.elem.calendarDate = document.getElementById('calendarDate')
        },

        // 更新
        update: function () {
            var _this = this
            setInterval(function () {
                _this._render(_this.date.getDate(), _this.date.getCalendarDate(), _this.date.getTime())
            }, 1000)
        },

        // 渲染
        _render: function (date, calendarDate, time) {
            this._setNumberImage(this.elem.hh, time[0])
            this._setNumberImage(this.elem.hl, time[1])
            this._setNumberImage(this.elem.mh, time[2])
            this._setNumberImage(this.elem.ml, time[3])
            this._setNumberImage(this.elem.sh, time[4])
            this._setNumberImage(this.elem.sl, time[5])
            this.elem.date.innerText = date[2] + " " +date[0] + "-" +date[1]
            this.elem.calendarDate.innerText = calendarDate
        },

        // 设置数字图片
        _setNumberImage: function (elem, value) {
            elem.style.backgroundImage = "url(./assets/img/" + value + ".svg)";
        }
    }

    var myWatchMeter = new WatchMeter()


</script>

</html>

完整代码包下载方式:

扫码关注公众号外卖FBI回复:2241

2020年英语6级真题(图1)

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

微信xixi_818888

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值