- 1). Launch your website design software, HTML editor or a plain text editor tool such as Microsoft Notepad.
- 2). Open the Web page on which you want to change the color of the scroll bar.
- 3). Scroll to the body section of the Web page. This is the text and code located between the opening "<body>" tag and closing "</body>" tag. Click on the page immediately after the opening "<body>" tag.
- 4). Paste the following code into the insertion location:
<script language="JavaScript1.2">
<!--
/*---For flat scrollbars. Colors: line1 - , line2 - #ffffff, face1 - #0066ff, face2 - #ffffff*/
function clrBar(line,face)
{
with(document.body.style)
{
scrollbarDarkShadowColor=line;
scrollbar3dLightColor=line;
scrollbarArrowColor="black";
scrollbarBaseColor=face;
scrollbarFaceColor=face;
scrollbarHighlightColor=face;
scrollbarShadowColor=face;
scrollbarTrackColor="#F3F3F3";
}
}
function setcolor()
{
var w = document.body.clientWidth;
var h = document.body.clientHeight;
var x = event.clientX;
var y = event.clientY;
if(x>w) clrBar("","#0066ff"); // Colors of active state
else clrBar("#ffffff","#ffffff"); // Colors of normal state
}
if (document.all){
clrBar(null,null);
document.onmousemove=setcolor;
}
-->
</script> - 5). Change each color attribute in the pasted code to your preferred colors. The color attribute is the six digit-code following the "#" key. You can use an online color-picker tool to get the correct color codes for your chosen colors. In this example, the main face color of the scroll bar is orange with a black border.
- 6). Save the edited Web page, and upload it to your host's server.
SHARE