asp.net.ph

Skip Navigation LinksHome > Abakada: Back to Basics > Language References > HTML Element Attributes > TEXT Attribute

TEXT Attribute | text Property


Sets or retrieves the foreground ( text ) color for the document BODY.

Syntax

Inline <body TEXT = strColor ... >
Script body.text = strColor ]

Possible Values

strColor String specifying any of the color names or values given in the Color Table.

The property is read/write with no default value.

Remarks

Specifying the color as a color name ( for example, "green" ) may not be recognized by some browsers, whereas the RGB color value should always be displayed accurately.

This attribute has been deprecated in favor of the CSS color property.

Example

The following example demonstrates use of the text object property to dynamically set the document BODY's text color. Note that this example will work only for pages whose elements are not formatted using stylesheets.

<body id="oBody">
...
<button onclick="oBody.text='green'">GREEN</button>
<button onclick="oBody.text='red'">RED</button>
<button onclick="oBody.text='blue'">BLUE</button>

 Show me 

Applies To

BODY



Check out related books at Amazon

© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note