Body textProperty
Body Object
Definition and Usage
The text property sets or returns the value of the text attribute of the body element.
The text property describes the text color of the document.
Syntax
Set the text property:
bodyObject.text="color"
Return the text property:
bodyObject.text
| Value | Description |
|---|---|
| color | Specifies the text color. See the completeCSS color values |
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the text property.
Example
Example
Return the value of the text property 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>
<body id="w3s" text="#0000FF">
<script>
document.write("The text color is: ")
document.write(document.getElementById("w3s").text);
</script>
</body>
</html>
Try it yourself »
Body Object Other Extensions