Input.image:hover

Hello,

Rightly I can’t define CSS or JavaScript need me, so I post in CSS forum. I have this HTML code:

<input type="image" name="submit" src="images/login.gif">

How I can make, that when hover mouse on this image, image will change to images/login_hover.gif? Thanks.

Hi,

This is really a javascript question as you can’t change the source of the input image in css although you could change a background image of an input on hover in mozilla but not in ie.

At the simplest level you could do something like this:


<input onmouseover="this.src='images/login_hover.gif'" onmouseout="this.src='images/login.gif'" type="image" name="submit" src="images/login.gif">

But it would be neater to do it unobtrusively so I’ll move this to the js forum so someone else can answer.:slight_smile: