[thelist] javascript, input type=image and mouseovers

Aylard JA (James) jaylard at equilon.com
Wed Dec 13 09:48:19 CST 2000


Katherine,

> How do I change the src of an <input type=image> on mouseover?  I'll
> willing concede that my object reference may be wrong
> (document.formName.inputName.src ??), or even that I'm terrible at
> javascript, but it's starting to feel impossible.

	Yes, it absolutely *is* possible, provided that you are using IE 4+
or Netscape 6. Use the onmouseover and onmouseout event handlers of the
input element (which it has as of HTML 4, which IE 4+ and Netscape 6
support), e.g.:

<input type="image" src="MyImage.jpg"
   onmouseover="this.src='YourImage.jpg';"
   onmouseout="this.src='MyImage.jpg';">

hth,
James Aylard




More information about the thelist mailing list