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

<style>
div {
  background-image: url('/static/demo/images/flower.gif');
  background-repeat: no-repeat;
  width: 400px;
  height: 400px;
  border: 1px solid #000000;
}
</style>

<body>

<h1>HTML Style 对象</h1>

<h2>backgroundPosition 属性</h2>

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

<script>
function myFunction() {
  document.getElementById("myDiv").style.backgroundPosition = "200px 40px";  
}
</script>

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