...

View Full Version : button impression onmouseover and onclick



phpnewb
12-20-2006, 03:32 AM
First off, I know very little javascript. I was wondering how to make a button (an image acting as a link instead of text) impression when the user goes over it and when the user clicks it.

Any help would be much appreciated.

Mr J
12-20-2006, 02:26 PM
You could try something like this and use background-image instead of background-color, unless you create seperate images for each event


<style type="text/css">
.out{width:100px;border:2px outset white;cursor:hand;cursor:pointer;background-color:#ccddcc}
.over{width:100px;border:2px groove white;cursor:hand;cursor:pointer;background-color:#ccddcc}
.down{width:90px;border:2px inset white;cursor:hand;cursor:pointer;background-color:#ccddcc}
</style>

<div class="out" onmouseover="this.className='over'" onmouseout="this.className='out'" onmousedown="this.className='down'" onmouseup="this.className='over'">Check</div>

phpnewb
12-21-2006, 02:41 AM
I don't want to use css to make the buttons. I have images of buttons, and I decided to get them in two slightly different colors for the onmouseover effect. They will change colors. How do I do this? The simplest way to do this would be appreciated.

Mr J
12-21-2006, 01:46 PM
Try this

<img src="image1.jpg" onmouseover="this.src='image2.jpg'" onmouseout="this.src='image1.jpg'">

phpnewb
12-21-2006, 03:00 PM
ok thx



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum