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