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

<body style="background-image:url('/static/demo/images/tree.png');background-repeat:no-repeat;">

<h1>HTML Style 对象</h1>

<h2>backgroundPosition 属性</h2>

<button type="button" onclick="myFunction()">定位背景图像</button>

<script>
function myFunction() {
  document.body.style.backgroundPosition="top right"; 
}
</script>

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