Mouseover and out to set Background Color

[Total: 0    Average: 0/5]

The background of the window will be set while mouseover an href link.

Head Code:

<style>
.b1 {background-color: #FFF;}
.b2 {background-color: #F00;}
.b3 {background-color: #00F;}
</style>
<script>
var cls=Array("","b1","b2","b3");
function doit(x)
{
  document.getElementById("bck").className=cls[x];
}
</script>

Body Code:

<body id=bck>
This code requires your body tag to have an id=bck.<BR>
like this:<BR>
&lt;body id=bck&gt;
<BR>
<a href="#" onmouseover="doit(2)" onmouseout="doit(1)">link 1</a>
<a href="#" onmouseover="doit(3)" onmouseout="doit(1)">link two</a>
<BR>
So this code will not work on this site as the body tag is not set right.

Times Viewed: 8

Leave a Reply

Your email address will not be published. Required fields are marked *