codecamp

HTML DOM Style borderRight 属性

Style borderRight 属性

Style 对象参考手册 Style 对象

定义和用法

borderRight 属性以速记形式设置或返回三个独立的右边框属性。

通过该属性,您可以设置/返回:

  • border-right-width
  • border-right-style
  • border-right-color

语法

设置 borderRight 属性:

Object.style.borderRight="width style color"

返回 borderRight 属性:

Object.style.borderRight

提示:borderRight 属性没有默认值。

参数 描述
width 设置右边框的宽度。
style 设置右边框的样式。
color 设置右边框的颜色。


浏览器支持

Internet ExplorerFirefoxOperaGoogle ChromeSafari

所有主要浏览器都支持 borderRight 属性。


实例

实例

更改右边框的宽度、样式和颜色:

<html>
<head>
<style type="text/css">
#ex1
{
border: thin dotted #FF0000;
}
</style>
<script>
function displayResult()
{
document.getElementById("ex1").style.borderRight="thick solid #0000FF";
}
</script>
</head>
<body>

<div id="ex1">This is some text.</div>
<br>
<button type="button" onclick="displayResult()">Change right border</button>

</body>
</html>

尝试一下 »


Style 对象参考手册 Style 对象
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

HTML DOM对象

HTML DOM 引用对象

HTML DOM Password 对象

HTML DOM Link 对象

HTML DOM Select 对象

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }