text
            收藏:0  
            阅读:38
        
        
        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>