HTML DOM scrollbarFaceColor 属性
JavaScript基础 2022-06-08 14:50:33小码哥的IT人生shichen
HTML DOM scrollbarFaceColor 属性
定义和用法
scrollbarFaceColor 属性设置滚动条的前景色。
语法:
Object.style.scrollbarFaceColor=color
可能的值
值 | 描述 |
---|---|
color | 颜色值可以是颜色名 (red),rgb 值 (rgb(255,0,0)),或十六进制 (#ff0000)。 |
实例
本例改变滚动条的前景色:
<html>
<head>
<script type="text/javascript">
function setScrollbarFaceColor()
{
document.body.style.scrollbarFaceColor="green";
}
</script>
</head>
<body>
<input type="button" onclick="setScrollbarFaceColor()"
value="Set ScrollbarFaceColor" />
</body>
</html>
TIY
完整实例【scrollbarFaceColor】:
<html>
<head>
<script type="text/javascript">
function setScrollbarFaceColor()
{
document.body.style.scrollbarFaceColor="green";
}
</script>
</head>
<body>
<input type="button" onclick="setScrollbarFaceColor()" value="Set ScrollbarFaceColor" />
<p>An example paragraph</p>
<p>An example paragraph</p>
<p>An example paragraph</p>
<p>An example paragraph</p>
<p>An example paragraph</p>
<p>An example paragraph</p>
<p>An example paragraph</p>
<p>An example paragraph</p>
<p>An example paragraph</p>
<p>An example paragraph</p>
<p>An example paragraph</p>
</body>
</html>
可以使用本站在线JavaScript测试工具测试上述代码运行效果:http://www.phpcodeweb.com/runjs.html