如何使用JavaScript设置轮廓颜色?
要设置轮廓颜色,请使用JavaScript中的outlineColor属性。您可以尝试运行以下代码以了解如何实现outlineColor属性-
示例
<!DOCTYPE html>
<html>
<head>
<style>
#box {
border: 2px solid red;
}
</style>
</head>
<body>
<div id = "box">
Demo Content
</div>
<br>
<button type = "button" onclick = "display()">Change outline color</button>
<script>
function display() {
document.getElementById("box").style.outlineColor = "#FF5733";
document.getElementById("box").style.outline = "2px solid";
}
</script>
</body>
</html>