HTMLTableElement: bgColor property
MDN Web Docs · نسخهٔ df622a2a1c1e · CC BY-SA 2.5 و مجوز جداگانهٔ ناشر برای نمونهکد
{{APIRef("HTML DOM")}}
The **bgcolor** property of the {{domxref("HTMLTableElement")}} represents the background color of the table.
توجه: Do not use this attribute anymore. Instead, use the CSS {{cssxref("background-color")}} property by modifying the element's [style](/en-US/docs/Web/API/HTMLElement/style) attribute or using a style rule.
Value
A string representing a color value.
When set to the null value, that null value is converted to the empty string (""), so elt.bgColor = null is equivalent to elt.bgColor = "".
Examples
js
// Set table background color to lightblue
const t = document.getElementById("TableA");
t.bgColor = "lightblue";Specifications
{{Specifications}}
Browser compatibility
{{Compat}}
See also
- {{cssxref("background-color")}}