944,150 Members | Top Members by Rank

Ad:
0

Change the Background Color with onMouseover (HTML)

by on Feb 5th, 2005
Use onMouseover to change the background color of your webpage. Can be applied to change other things like images and so on.
HTML and CSS Code Snippet (Toggle Plain Text)
  1. <!-- Experiments with the mouse vegaseat 6/15/02 -->
  2. <!-- onMouseover, href, bgcolor -->
  3.  
  4. <html>
  5. <head>
  6.  
  7. <title>change the background color with onMouseover</title>
  8.  
  9. </head>
  10. <body>
  11.  
  12. Move the cursor to the color you want ...
  13. <br>
  14. <br>
  15. <a href="" onMouseover="document.bgColor='red'">Red</a>
  16. <br>
  17. <a href="" onMouseover="document.bgColor='orange'">Orange</a>
  18. <br>
  19. <a href="" onMouseover="document.bgColor='yellow'">Yellow</a>
  20. <br>
  21. <a href="" onMouseover="document.bgColor='green'">Green</a>
  22. <br>
  23. <a href="" onMouseover="document.bgColor='magenta'">Magenta</a>
  24. <br>
  25. <a href="" onMouseover="document.bgColor='purple'">Purple</a>
  26. <br>
  27.  
  28. </body>
  29. </html>
Comments on this Code Snippet
Sep 14th, 2006
0

Re: Change the Background Color with onMouseover (HTML)

:rolleyes: hai
Unverified User
parthireach is offline Offline
1 posts
since Sep 2006
Oct 15th, 2006
0

Re: Change the Background Color with onMouseover (HTML)

i think its not working
Newbie Poster
prathapvs is offline Offline
2 posts
since Oct 2006
Mar 30th, 2007
0

Re: Change the Background Color with onMouseover (HTML)

Boring 100% Nothing Work It. Like U
Newbie Poster
anilexi is offline Offline
3 posts
since Mar 2007
Jun 9th, 2007
0

Re: Change the Background Color with onMouseover (HTML)

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.
Newbie Poster
remotions is offline Offline
1 posts
since Jun 2007
Aug 14th, 2008
1

Re: Change the Background Color with onMouseover (HTML)

is it possible to do this same work using outside"CSS" file?plz do reply
thanks
lizzeelike
Newbie Poster
lizzeelike is offline Offline
2 posts
since Aug 2008
Nov 25th, 2011
0

Re: Change the Background Color with onMouseover (HTML)

NO
Newbie Poster
warest is offline Offline
1 posts
since Nov 2011
Nov 25th, 2011
0

what is anchor teg?

how can use anchor teg in html . what's type of anchor teg?
Newbie Poster
pankaj dadhich is offline Offline
1 posts
since Nov 2011
Nov 25th, 2011
0

Re: Change the Background Color with onMouseover (HTML)

You can do that by using CSS. Supposind you want to change the background colour of class MenuOption object:
.MenuOption:hover {
   background-color: grey;
}
Junior Poster in Training
mikrosfoititis is offline Offline
74 posts
since Nov 2011
Message:
Previous Thread in HTML and CSS Forum Timeline: Need to overlay portion of flash cell with .png links
Next Thread in HTML and CSS Forum Timeline: Dreamweaver question





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC