Javascript - 错误背景未显示

Javascript - error background not showing

本文关键字:显示 背景 错误 Javascript      更新时间:2023-09-26

当我运行这个javascript时,我得到:Use of Mutation Events is deprecated. Use MutationObserver instead.

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>AudioPlayer</title>
</head>
<body>
<div id="Player"></div>
<script>
function Player() {
    this.width = '100%';
    this.height = '10px';
    this.family = 'toma';
    this.size = '10px';
    this._bg = '#00000';
    this.titleContainerWidth = '100px';
    this.alignText = 'center';
    this.titleMargin = '0 auto';
    this.titleText = 'THI IS THE TITLE';
    this.color = '#29FFFF';
    this.id = 'Player';
    this.autoplay = false;
    this.pl = document.getElementById(this.id);
    this.cadd = function(element) {
        var elemnt = document.createElement(element);
        this.pl.appendChild(elemnt);
        return elemnt
    }
    this._make = function() {
        var title = this.cadd('p');
        title.style.fontFamily = this.family;
        title.style.fontSize = this.size;
        title.style.textAlign = this.alignText;
        title.style.color = this.color;
        title.style.width = this.titleContainerWidth;
        title.style.margin = this.titleMargin;
        title.innerHTML = "<marquee behavior='scrolling' speed='1' loop='true'>" + this.titleText + "</marquee>";
        this.pl.style.width = this.width;
        this.pl.style.background = this._bg;
    }

}
player = new Player();
player._make();
</script>
</body>
</html>

什么意思?我只是猜测这就是div id 的背景不显示的原因。但是,我不确定。可能是我在javascript中如何称呼div或标题吗?

CSS 十六进制颜色有一个哈希值,后跟三个或六个字符。你的有五个。