JavaScriptのカラー属性


  翻訳結果:

英['kʌlə(r)] 美[ˈkʌlɚ]

n.<美>色、色;肌の色、顔色、血の色;色素、染料;エッセンス

v .<Beauty>カラーリング; 色の変更; ホワイトウォッシュ、レンダリング、カラーリング; 赤面

三人称単数: 色 複数形: カラー 現在分詞: カラーリング 過去形: 色付き過去分詞: 色付き

JavaScriptのカラー属性構文

関数:テキストの色を設定します

構文: Object.style.color=color

JavaScriptのカラー属性例

<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>

インスタンスの実行 »

[インスタンスの実行] ボタンをクリックしてオンライン インスタンスを表示します

人気のおすすめ

ホームページ

ビデオ

に質問