Change BackGround Color of a Page when Mouse Over Using HTML

Syedshakeer
Posted by Syedshakeer under Others category on | Views : 2985
<html>
<body>
<a href="/onmouseover="document.bgcolor='green'" onmouseover="document.bgcolor=' white'">Anchor</a>
</body>
</html>

Comments or Responses

Posted by: Raja on: 3/16/2009 Level:Starter | Status: [Member]
Man,

do you test the code before posting it on the website? In which language you have written and in which browser you have tested? Your code is not working. I could change the above code as below and its working now.

<html>

<script language="javascript" type="text/javascript">
function ChangeBG(c)
{
document.body.bgColor = c;
}
</script>
<body>

<a href="javascript:ChangeBG('green')" onmouseover="ChangeBG('red')">Anchor</a>

</body>

</html>


Thanks

Login to post response