document.fgColor

JavaScript 1.0+, JScript 1.0+ Nav2+, IE 3+, Opera3+ Syntax

document.fgColor

Description

The fgColor property specifies the default text color of all the text that appears in a Web document. This is equivalent to assigning the color to the text attribute in the <body> tag. The color is expressed as a string in hexadecimal digits or as one of the JavaScript standard color names. The hexadecimal form is made up of 6 digits that follow the pattern "RRGGBB."

Example

Listing 7.98 sets the default color of all the text on the page to blue.

Listing 7.98 Set the Text Color with the fgColor Property
 <html> <script language="JavaScript"> <!-- Hide //Set the text color to blue. document.fgColor="0000ff"; //Hide End ---> </script> ...

Get Pure JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.