HTML DOM borderTopColor 属性

HTML DOM Style

定义和用法

borderTopColor 属性设置元素上边框的颜色。

语法:

Object.style.borderTopColor=color-name|color-RGB|color-hex

实例

本例改变段落的上边框的颜色:

<html>
<head>
<style type="text/css">
p
{ 
border: thick solid #FF0000
}
</style>
<script type="text/javascript">
function changeBorderColor()
{
document.getElementById("p1").style.borderTopColor="#0000FF";
}
</script>
</head>
<body>

<input type="button" onclick="changeBorderColor()" 
value="Change paragraph border color" />

<p id="p1">This is a paragraph</p>

</body>
</html>

HTML DOM Style