Node-red仪表板-Javascript Watch更改字体大小

时间:2019-11-10 10:30:33

标签: javascript dashboard node-red

这两个代码中的任何一个运行时,我的节点红色仪表板都从“标准”字体大小更改为我的编码大小,为什么?

在其他任何地方运行它们中的任何一个,它们都能正常工作.....

(function () {
    function checkTime(i) {
        return (i < 10) ? "0" + i : i;
    }

    function startTime() {
        var today = new Date(),
            h = checkTime(today.getHours()),
            m = checkTime(today.getMinutes()),
            s = checkTime(today.getSeconds());
        document.getElementById('time').innerHTML =h + ":" + m + ":" + s;
        t = setTimeout(function () {
            startTime()
        }, 1000);
    }
    startTime();
})();
</script>
<div id="time" style="font-size:24px"></div>

这也不起作用:

(function () {
    function checkTime(i) {
        return (i < 10) ? "0" + i : i;
    }

    function startTime() {
        var today = new Date(),
            h = checkTime(today.getHours()),
            m = checkTime(today.getMinutes()),
            s = checkTime(today.getSeconds());
document.getElementById('time').innerHTML = '<font size="24">' + h + ":" + m + ":" + s + '</font>';
        t = setTimeout(function () {
            startTime()
        }, 1000);
    }
    startTime();
})();
</script>
<div id="time"></div>

0 个答案:

没有答案