document.fgColor
Deprecated
Avoid using this feature in new projects. Document color attributes are superseded by CSS. This feature may be a candidate for removal from web standards or browsers.>
Consider using the following features instead: background-color、Color、CSS object model或getComputedStyle().>
概述
fgColor 属性用来获取或设置当前文档的前景色或者文本颜色。
语法
var color = document.fgColor; document.fgColor = color;
参数
color是一个颜色值,可以为一个颜色类型,比如"red",或者一个 16 进制 RGB 值,比如 "#ff0000".
例子
document.fgColor = "white"; document.bgColor = "darkblue";
备注
在 Mozilla Firefox 中,该属性的默认值是黑色.(black 或者#000000).
document.fgColor 属性已经在DOM Level 2中被废弃。推荐使用的css属性为color (用法为 document.body.style.color = "red").
另外一个类似的属性是 document.body.text, 该属性也在 HTML 4.01 中被废弃,推荐使用 CSS 属性。