HTML DOM Body text attributes
Definition and Usage
text property sets or returns the text attribute of the body element.
text attribute describes the text color of the document.
grammar
Setting text attributes:
bodyObject.text="color"
Returns text attributes:
bodyObject.text
值 | 描述 |
---|---|
color | 指定了文本颜色。查看完整的 CSS 颜色值 |
Browser Support
All major browsers support the text attribute.
Examples
Examples
Returns text attribute value 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"
Body Object