HTML DOM borderLeftColor 属性
JavaScript基础 2022-06-08 14:24:57小码哥的IT人生shichen
HTML DOM borderLeftColor 属性
定义和用法
borderLeftColor 属性设置元素的左边框的颜色。
语法:
Object.style.borderLeftColor=color-name|color-rgb|color-hex|transparent
实例
本例改变左边框的颜色:
<html>
<head>
<style type="text/css">
p
{
border: thick solid #FF0000
}
</style>
<script type="text/javascript">
function changeBorderColor()
{
document.getElementById("p1").style.borderLeftColor="#0000FF";
}
</script>
</head>
<body>
<input type="button" onclick="changeBorderColor()"
value="Change left border" />
<p id="p1">This is a paragraph</p>
</body>
</html>
TIY
完整实例【borderleftColor - 改变左边框的颜色】:
<html>
<head>
<style type="text/css">
p
{
border: thick solid #FF0000;
}
</style>
<script type="text/javascript">
function changeBorderColor()
{
document.getElementById("p1").style.borderLeftColor="#0000FF";
}
</script>
</head>
<body>
<input type="button" onclick="changeBorderColor()" value="Change left border" />
<p id="p1">This is a paragraph</p>
</body>
</html>
可以使用本站在线JavaScript测试工具测试上述代码运行效果:http://www.phpcodeweb.com/runjs.html