JavaScript Reference/Javascript Properties/color — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Текущая версия на 08:21, 26 мая 2010
"color" Example
<html>
<body>
<script language="JavaScript">
function function1() {
document.getElementById("myFont").color = "green";
}
function function2() {
document.getElementById("myFont").color = "maroon";
}
</script>
<p>
<font face="Verdana" id="myFont">
<b>Sample text.</b>
</font>
</p>
<button onClick="function1();">Make Text Green</button>
<button onClick="function2();">Make Text Maroon</button>
</body>
</html>
"color" is applied to
+----------------+--------------------------------------------------------------+
| Applied_To |<basefont> <font> |
| |<hr> |
+----------------+--------------------------------------------------------------+
"color" Syntax and Note
Note:
Read and write property.
Sets the element color.
Value:
Web color name or hexadecimal value in #RRGGBB format.
Syntax:
document.getElementById("elementID").color = value
document.all.elementID.color = value // IE only