中文字幕一区二区人妻电影,亚洲av无码一区二区乱子伦as ,亚洲精品无码永久在线观看,亚洲成aⅴ人片久青草影院按摩,亚洲黑人巨大videos

Style backgroundImage 屬性

Style 對象參考手冊 Style 對象

定義和用法

backgroundImage 屬性設(shè)置或返回元素的背景圖像。

語法

設(shè)置 backgroundImage 屬性:

Object.style.backgroundImage="url('URL')|none|inherit"

返回 backgroundImage 屬性:

Object.style.backgroundImage
描述
url('URL') 圖像文件的位置。
none 默認(rèn)。沒有背景圖像。
inherit background-image 屬性的設(shè)置從父元素繼承。

瀏覽器支持

Internet ExplorerFirefoxOperaGoogle ChromeSafari

所有主要瀏覽器都支持 backgroundImage 屬性。

注意:IE7 及更早的版本不支持 "inherit" 值。IE8 只有規(guī)定了 !DOCTYPE 才支持 "inherit"。IE9 支持 "inherit"。


提示和注釋

提示:除了背景圖片,您也應(yīng)該指定背景色。如果圖像是不可用的,將使用背景色。


實(shí)例

實(shí)例

設(shè)置背景圖像:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>小白教程(json.cn)</title>
<script>
function displayResult(){
????document.body.style.backgroundColor="#f3f3f3";
????document.body.style.backgroundImage="url('img_tree.png')";
}
</script>
</head>
<body>

<h1>Hello World!</h1>
<br>
<button type="button" onclick="displayResult()">設(shè)置背景圖片</button>

</body>
</html>

運(yùn)行代碼 ?

Style 對象參考手冊 Style 對象其他擴(kuò)展