英['k?l?(r)]? ?美[?k?l?]??

n.<美>顏色,色彩;膚色,臉色,血色;顏料,染料;本質(zhì)

#v .<美>給…塗上顏色;改變…的顏色;粉飾,渲染,使帶上色彩;臉紅

第三人稱單數(shù): colors 複數(shù): colors 現(xiàn)在分詞: coloring 過去式: colored 過去分詞: colored

javascript color屬性 語法

作用:設定文字的顏色

語法:Object.style.color=color

javascript color屬性 範例

<html>
<head>
<script type="text/javascript">
function setColor()
{
document.getElementById("p1").style.color="#ff0000";
document.getElementById("p2").style.color="magenta";
}
</script>
</head>
<body>

<p id="p1">This is an example paragraph</p>
<p id="p2">This is also an example paragraph</p>

<input type="button" onclick="setColor()"
value="Change color of text" />

</body>
</html>

執(zhí)行實例 ?

點擊 "執(zhí)行實例" 按鈕查看線上實例