text 属性可设置或者返回 body 元素的 text 属性值。
text 属性描述了文档的文本颜色。
设置 text 属性:
返回 text 属性:
所有主要浏览器都支持 text 属性。
返回 body 元素的 text 属性值:
<html> <body id="w3s" text="#0000FF"> <script> document.write("The text color is: ") document.write(document.getElementById("w3s").text); </script> </body> </html>