954,604 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?

Change the Background Color with onMouseover (HTML)

0
By vegaseat on Feb 5th, 2005 1:38 pm

Use onMouseover to change the background color of your webpage. Can be applied to change other things like images and so on.

<!-- Experiments with the mouse  vegaseat  6/15/02 -->
<!-- onMouseover, href, bgcolor -->

<html>
<head>

	<title>change the background color with onMouseover</title>
	
</head>
<body>

Move the cursor to the color you want ...
<br>
<br>
<a href="" onMouseover="document.bgColor='red'">Red</a>
<br>
<a href="" onMouseover="document.bgColor='orange'">Orange</a>
<br> 
<a href="" onMouseover="document.bgColor='yellow'">Yellow</a>
<br> 
<a href="" onMouseover="document.bgColor='green'">Green</a>
<br> 
<a href="" onMouseover="document.bgColor='magenta'">Magenta</a>
<br> 
<a href="" onMouseover="document.bgColor='purple'">Purple</a>
<br> 

</body>
</html>

:rolleyes: hai

parthireach
Newbie Poster
1 post since Sep 2006
Reputation Points: 10
Solved Threads: 0
 

i think its not working

prathapvs
Newbie Poster
2 posts since Oct 2006
Reputation Points: 10
Solved Threads: 0
 

;) ;) Boring 100% Nothing Work It. Like U

anilexi
Newbie Poster
3 posts since Mar 2007
Reputation Points: 10
Solved Threads: 0
 

It works, just you need to fill the href="" with # so that it looks like this: href="#". Or you will have mouse click to point your browser to the start page of your site. Also you have to disable CSS background styles for particular page.

remotions
Newbie Poster
1 post since Jun 2007
Reputation Points: 10
Solved Threads: 0
 

is it possible to do this same work using outside"CSS" file?plz do reply
thanks
lizzeelike

lizzeelike
Newbie Poster
2 posts since Aug 2008
Reputation Points: 10
Solved Threads: 1
 
warest
Newbie Poster
1 post since Nov 2011
Reputation Points: 10
Solved Threads: 0
 

how can use anchor teg in html . what's type of anchor teg?

pankaj dadhich
Newbie Poster
1 post since Nov 2011
Reputation Points: 10
Solved Threads: 0
 

You can do that by using CSS. Supposind you want to change the background colour of class MenuOption object:

.MenuOption:hover {
   background-color: grey;
}
mikrosfoititis
Junior Poster in Training
74 posts since Nov 2011
Reputation Points: 18
Solved Threads: 11
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You