英 [?b?kɡraund ?k?l?]? ?美 [?b?k?ɡra?nd ?k?l?]??

背景顏色

javascript backgroundColor屬性 語(yǔ)法

作用:設(shè)置元素的背景顏色。

語(yǔ)法:Object.style.backgroundColor=color-name|color-rgb|color-hex|transparent

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>

運(yùn)行實(shí)例 ?

點(diǎn)擊 "運(yùn)行實(shí)例" 按鈕查看在線實(shí)例