Sử dụng borderTopStyle để đặt kiểu đường viền cho cạnh trên (solid, dashed, dotted...).
Ví dụ
<!DOCTYPE html>
<html>
<head>
<style>
#box { border: thick solid gray; width: 300px; height: 300px; }
</style>
</head>
<body>
<div id="box">Demo Text</div>
<br><br>
<button type="button" onclick="display()">Thay đổi kiểu viền trên</button>
<script>
function display() {
document.getElementById("box").style.borderTopStyle = "dashed";
}
</script>
</body>
</html>