This paper illustrates the method of realizing the color-changing of the mouse by the Web scroll bar of JS. Share to everyone for your reference. The implementation methods are as follows:
Copy Code code as follows:
<TITLE>JS implement Web scroll bar sensor mouse color </title>
<body>
Turn your gaze to the scroll bar on the right. Isn't it beautiful? The mouse will also change color?
<br><br><script language= "JavaScript" >
<!--
function ScrollBar (line,face,theme)
{
if (!line| |! Face
{
Line=null;
Face=null;
Switch (theme)
{
Case "Blue":
var line= "#78AAFF";
var face= "#EBF5FF";
Break
Case "Orange":
var line= "#FBBB37";
var face= "#FFF9DF";
Break
Case "Red":
var line= "#FF7979";
var face= "#FFE3DD";
Break
Case "Green":
var line= "#00C600";
var face= "#D1EED0";
Break
Case "Neo":
var line= "#BC7E41";
var face= "#EFE0D1";
Break
}
}
With (Document.body.style)
{
Scrollbardarkshadowcolor=line;
Scrollbar3dlightcolor=line;
Scrollbararrowcolor= "BLACK";
Scrollbarbasecolor=face;
Scrollbarfacecolor=face;
Scrollbarhighlightcolor=face;
Scrollbarshadowcolor=face;
Scrollbartrackcolor= "#F3F3F3";
}
}
function Colorbar () {
var w = document.body.clientWidth;
var h = document.body.clientHeight;
var x = Event.clientx;
var y = event.clienty;
if (x>w) scrollBar (' #000080 ', ' #BFDFFF '); Your Colors
else ScrollBar (Null,null, "Neo"); A Predefined Theme
}
if (document.all) {
ScrollBar (Null,null, "Neo");
Document.onmousemove=colorbar;
}
-->
</script>
<br/>
<div style= "width:100%;height:1000px;" ></div>
</body>
I hope this article will help you with your JavaScript programming.