UK [?b?kɡraund ?k?l?] US [?b?k?ɡra?nd ?k?l?]

背景色

JavaScriptのbackgroundColorプロパティ 構(gòu)文

関數(shù):要素の背景色を設(shè)定します。

構(gòu)文: Object.style.backgroundColor=カラー名|カラーrgb|カラー16進(jìn)|透明

JavaScriptのbackgroundColorプロパティ 例

<html>
<head>
<style type="text/css">
body
{
background-color:#B8BFD8;
}
</style>
<script type="text/javascript">
function changeStyle()
{
document.body.style.backgroundColor="#FFCC80";
}
</script>
</head>
<body>

<input type="button" onclick="changeStyle()"
value="Change background color" />

</body>
</html>

インスタンスの実行 ?

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