1,105,644 Community Members

Change the Background Color with onMouseover (HTML)

Member Avatar
Reputation Points: 1,544 [?]
Q&As Helped to Solve: 1,872 [?]
Skill Endorsements: 67 [?]
 
0
 

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>
parthireach
Newbie Poster
1 post since Sep 2006
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
Unverified Member
 
0
 

:rolleyes: hai

Member Avatar
prathapvs
Newbie Poster
2 posts since Oct 2006
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

i think its not working

Member Avatar
anilexi
Newbie Poster
3 posts since Mar 2007
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

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

Member Avatar
remotions
Newbie Poster
1 post since Jun 2007
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
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.

Member Avatar
lizzeelike
Newbie Poster
2 posts since Aug 2008
Reputation Points: 0 [?]
Q&As Helped to Solve: 1 [?]
Skill Endorsements: 0 [?]
 
1
 

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

Member Avatar
warest
Newbie Poster
1 post since Nov 2011
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

NO

Member Avatar
pankaj dadhich
Newbie Poster
1 post since Nov 2011
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

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

Member Avatar
mikrosfoititis
Junior Poster in Training
74 posts since Nov 2011
Reputation Points: 0 [?]
Q&As Helped to Solve: 12 [?]
Skill Endorsements: 1 [?]
 
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;
}
safvansouri
Newbie Poster
1 post since May 2013
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
Unverified Member
 
0
 

so i got a code like onMouseOver="this.bgColor=&#39;#fb2b27&#39;" how do i change it in to green color

Member Avatar
TonyG_cyprus
Posting Whiz
329 posts since Dec 2009
Reputation Points: 36 [?]
Q&As Helped to Solve: 47 [?]
Skill Endorsements: 2 [?]
 
0
 

First of all, this thread is over 6 years old, so you are lucky to get a reply, read the rules.
Search before asking.
You are obviously very new to this if you didn't know &#39; is the ANSI code for ' and the #FB2B27is a red, #00B008 will be a green so the code is "this.bgColor=&#39;#00B008&#39;"and this will give you a green. Or you can write it "this.bgColor='#00B008'"

You
Post:
Start New Discussion
Tags Related to this Article