Body text 屬性

定義和用法
text 屬性可設置或者返回 body 元素的 text 屬性值。
text 屬性描述了文檔的文本顏色。
語法
設置 text 屬性:
bodyObject.text="color"
返回 text 屬性:
bodyObject.text
值 | 描述 |
---|---|
color | 指定了文本顏色。查看完整的 CSS 顏色值 |
流覽器支持
所有主要流覽器都支持 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>
<body id="w3s" text="#0000FF">
<script>
document.write("The text color is: ")
document.write(document.getElementById("w3s").text);
</script>
</body>
</html>
