Javascript - 错误背景未显示
Javascript - error background not showing
当我 运行 这个 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 十六进制颜色的哈希值后跟三个或六个字符。你的有五个。
当我 运行 这个 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 十六进制颜色的哈希值后跟三个或六个字符。你的有五个。