<html>
<head>
<style>
#myDIV {
border: 1px solid black;
width: 300px;
height: 300px;
}
</style>
</head>
<body>
<h1>用 JavaScript 改变右边框</h1>
<p>点击“试一试”按钮更改 DIV 元素的 border-right 属性:</p>
<button onclick="myFunction()">试一试</button>
<div id="myDIV">
<h1>Hello</h1>
</div>
<script>
function myFunction() {
document.getElementById("myDIV").style.borderRight = "5px dotted lightblue";
}
</script>
</body>
</html>