Document.fgColor (Property)

The foreground color for text in the current document.


DOM level - 0
JavaScript - 1.0
JScript - 1.0
Internet Explorer - 3.02
Netscape - 2.0
Opera - 3.0
Property/method value type:Color value
JavaScript syntax:-myDocument.fgColor
-myDocument.fgColor = aColorValue
HTML syntax:<BODY TEXT="aColorValue">
Argument list:aColorValueA hex string or color name

This value controls the foreground text in the document body. You should use the normal color values to define the required color.

This is the default text color for the document. It corresponds to the TEXT attribute in the <BODY> tag.

Default foreground text is colored according to this setting unless it is in an <A> tag when the alinkColor, linkColor and vlinkColor values override it. The foreground text color can be changed in-line with the <FONT COLOR="..."> HTML tag attribute.

Now that the style control facilities are more sophisticated, this tag attribute is likely to fall into disuse. On the other hand it does work consistently on both MSIE and Netscape where style sheet controls do not.

DOM level 1 deprecates the use of this property in favor of the BODY.text property.


See also:BODY.aLink,, BODY.text, BODY.vLink, Color names, Color value, Document object, Document.alinkColor, Document.bgColor, Document.linkColor, Document.vlinkColor