Start New Discussion within our UI / UX Design Community

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 -->


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

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


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.

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

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

.MenuOption:hover {
   background-color: grey;

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

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'"

The article starter has earned a lot of community kudos, and such articles offer a bounty for quality replies.