Body text property

HTML DOM Body text attribute Body object

Definitions and usages

The text property can set or return the text property value of the body element.

The text property describes the text color of the document.

Grammar

Set the text property:

bodyObject.text=" color "

Return text property:

bodyObject.text

value describe
color Specifies the text color.View full CSS color value


Browser support

HTML DOM Body text attribute HTML DOM Body text attribute HTML DOM Body text attribute HTML DOM Body text attribute HTML DOM Body text attribute

Text properties are supported by all major browsers.


Returns the text property value of the body element:

<html>
<body id="w3s" text="#0000FF">

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

</body>
</html>

Try it out . . .


HTML DOM Body text attribute Body object