Dokument: bgColor-Eigenschaft
Deprecated
Avoid using this feature in new projects. Document color attributes are superseded by CSS. This feature may be a candidate for removal from web standards or browsers.>
Consider using the following features instead: background-color, Color, CSS object model oder getComputedStyle().>
Die veraltete bgColor-Eigenschaft ruft die Hintergrundfarbe des aktuellen Dokuments ab oder setzt diese.
Wert
Ein String, der die Farbe als Wort (z.B. "red") oder als hexadezimaler Wert (z.B. "#ff0000") darstellt.
Wenn auf den Wert null gesetzt, wird dieser null-Wert in den leeren String ("") umgewandelt, sodass document.bgColor = null gleichbedeutend ist mit document.bgColor = "".
Beispiele
document.bgColor = "darkblue";
Hinweise
Der Standardwert für diese Eigenschaft in Firefox ist Weiß (#ffffff in hexadezimal).
document.bgColor ist im HTML-Spezifikation veraltet. Die empfohlene Alternative ist die Verwendung von CSS-Stil background-color, auf die über das DOM mit document.body.style.backgroundColor zugegriffen werden kann.
Spezifikationen
| Spezifikation |
|---|
| HTML> # dom-document-bgcolor> |