<html>
<body>
<div id="myDiv" style="border-top:5px solid red;">这是 div 元素。</div>
<br>
<button type="button" onclick="myFunction()">返回上边框</button>
<script>
function myFunction() {
alert(document.getElementById("myDiv").style.borderTop);
}
</script>
</body>
</html>