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 sie.
Wert
Ein String, der die Farbe als Wort (z.B. "red") oder als Hexadezimalwert (z.B. "#ff0000") darstellt.
Wenn der Wert auf null gesetzt wird, wird dieser null-Wert in den leeren String ("") umgewandelt, sodass document.bgColor = null äquivalent zu document.bgColor = "" ist.
Beispiele
document.bgColor = "darkblue";
Hinweise
Der Standardwert für diese Eigenschaft in Firefox ist Weiß (#ffffff in Hexadezimal).
document.bgColor ist in der HTML-Spezifikation veraltet. Die empfohlene Alternative ist die Verwendung des CSS-Stils background-color, der über das DOM mit document.body.style.backgroundColor zugänglich ist.
Spezifikationen
| Spezifikation |
|---|
| HTML> # dom-document-bgcolor> |