YouTip LogoYouTip

Prop Body Bgcolor

HTML DOM Body bgColor Property

HTML DOM Body bgColor Property

Tutorial -- Learning is not just about technology, but also about dreams!

JavaScript Reference Manual

Overview

JavaScript Objects

Browser Objects

DOM Objects

HTML Objects

<blockquote>

HTML DOM Button Object

Explore Further

  • Web Browsers
  • Scripting Languages
  • Script
  • Computer Science
  • Programming
  • Software
  • Web Services
  • Programming Languages
  • Web Design and Development
  • Scripts

Body bgColor Property

Body Object Reference Manual Body Object


Definition and Usage

The bgColor property sets or returns the value of the bgcolor attribute of the body element.

The bgcolor attribute specifies the background color of a document.

Syntax

Set the bgColor property:

bodyObject.bgColor="_color_"

Return the bgColor property:

bodyObject.bgColor
Value Description
_color_ Specifies the background color. See the full list of CSS Color Values.

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

The bgColor property is supported by all major browsers.


Example

Example

Return the value of the bgcolor attribute of the body element:

<html>

<body id="w3s" bgcolor="#E6E6FA">

<script>
document.write("The background color is: ")
document.write(document.getElementById("w3s").bgColor);
</script>

</body>

</html>

Try it yourself Β»


Body Object Reference Manual Body Object

<blockquote>

HTML DOM Button Object

iFlytek Xingchen Coding Plan includes free model call quota, DeepSeek, GLM, Kimi, MiniMax, one-stop experience and deployment platform. Configuration Guide Β₯3.9/month Subscribe Now

Click to Share Notes

Cancel

← Xml DomProp Body Background β†’