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

<h1>HTML Style 对象</h1>

<h2>backgroundImage 属性</h2>

<button type="button" onclick="myFunction()">设置背景图像</button>

<script>
function myFunction() {
  document.body.style.backgroundColor = "#f3f3f3";
  document.body.style.backgroundImage = "url('/static/demo/images/tree.png')";
}
</script>

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