![]() |
<HTML> <HEAD> </HEAD> <BODY> <IMG SRC="button.gif" WIDTH=64 HEIGHT=32 ALT="Button" ONMOUSEDOWN="alert('What a pretty button!')"> </BODY> </HTML> |
![]() |
<HTML> <HEAD> </HEAD> <BODY> <IMG SRC="face1.gif" WIDTH=64 HEIGHT=64 ALT="Click on face" NAME="face" ONMOUSEDOWN="document.images['face'].src='face2.gif'"> </BODY> </HTML> |
document.face.src = 'face2.gif'
However, the way that I have used above is more flexible and means you can do weird and wonderful things once you start using variables, loops and arrays. I have used the more flexible way throughout my website, rather than having two methods and fluctuating between the two. If you only want to do obvious code, though, you may prefer the simpler way.
![]() |
<HTML> <HEAD> </HEAD> <BODY> <IMG SRC="face1.gif" WIDTH=64 HEIGHT=64 ALT="Click on face" NAME="smile" ONMOUSEDOWN="document.images['smile'].src='face2.gif'" ONMOUSEUP="document.images['smile'].src='face1.gif'"> </BODY> </HTML> |
Internet Explorer | Firefox | |
---|---|---|
First click (down) | ONMOUSEDOWN | ONMOUSEDOWN |
First click (up) | ONMOUSEUP ONCLICK | ONMOUSEUP ONCLICK |
Second click (down) | ONMOUSEDOWN | |
Second click (up) | ONMOUSEUP ONDOUBLECLICK | ONMOUSEUP ONCLICK ONDOUBLECLICK |
![]() ![]() |
<HTML> <HEAD> </HEAD> <BODY> <IMG SRC="man.gif" WIDTH=64 HEIGHT=64 ALT="Catch me" NAME="pos1" ONMOUSEOVER="document.images['pos1'].src='blank.gif'; document.images['pos2'].src='man.gif'"> <IMG SRC="blank.gif" WIDTH=64 HEIGHT=64 ALT="if you can!" NAME="pos2" ONMOUSEOVER="document.images['pos1'].src='man.gif'; document.images['pos2'].src='blank.gif'"> </BODY> </HTML> |
Start
![]() ![]() ![]() |
<HTML> <HEAD> </HEAD> <BODY> Start <IMG SRC="hsp.gif" ALT=" " NAME="h1" ONMOUSEOVER="document.images['h1'].src = 'horse1.gif'" ONMOUSEOUT="document.images['h1'].src = 'hsp.gif'"> <IMG SRC="hsp.gif" ALT=" " NAME="h2" ONMOUSEOVER="document.images['h2'].src = 'horse2.gif'" ONMOUSEOUT="document.images['h2'].src = 'hsp.gif'"> <IMG SRC="hsp.gif" ALT=" " NAME="h3" ONMOUSEOVER="document.images['h3'].src = 'horse3.gif'" ONMOUSEOUT="document.images['h3'].src = 'hsp.gif'"> </BODY> </HTML> |
Click on thumbnail for larger picture![]() ![]() ![]() ![]() |
<HTML> <HEAD> </HEAD> <BODY> Click on thumbnail for larger picture<BR><BR> <IMG SRC="sbergamot.jpg" ALT=" " ONMOUSEdown="document.images['large'].src='bergamot.jpg'"> <IMG SRC="sfoxglove.jpg" ALT=" " ONMOUSEdown="document.images['large'].src='foxglove.jpg'"> <IMG SRC="spansy.jpg" ALT=" " ONMOUSEdown="document.images['large'].src='pansy.jpg'"> <BR><BR> <IMG SRC="space.jpg" ALT=" " NAME="large"> </BODY> </HTML> |
© Jo Edkins 2005