代码示例:(标识:jsck_style_backgroundimage_3)
<!DOCTYPE html>
<html>
<body>

<h1>HTML Style 对象</h1>

<h2>backgroundImage 属性</h2>

<p>背景图像是:</p>

<p id="demo"></p>

<div id="myDiv" style="background-image:url('/static/demo/images/tree.png');border:1px solid black;height:400px;width:400px;">
This is myDiv.</div>
<br>

<script>
let img = document.getElementById("myDiv").style.backgroundImage;
document.getElementById("demo").innerHTML = img;
</script>

</body>
</html>
运行结果: