<!DOCTYPE html>
<html>
<head>
<style>
#myDIV {
border: 1px solid black;
width: 300px;
height: 150px;
padding: 35px;
background: url('paper.gif') no-repeat;
}
</style>
</head>
<body>
<h1>使用 JavaScript 更改 background-origin</h1>
<p>单击“试一试”按钮将 DIV 元素的 background-origin 属性设置为“content-box”:</p>
<button onclick="myFunction()">试一试</button>
<div id="myDIV">
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.
</div>
<script>
function myFunction() {
document.getElementById("myDIV").style.backgroundOrigin = "content-box";
}
</script>
</body>
</html>