Forums

This topic is locked

Mousedown event

Posted 25 Jun 2005 18:24:17
1
has voted
25 Jun 2005 18:24:17 Nikkisha Barnard posted:
Hi,

I'm trying to do sort of like a thumbnail and dynamically show the picture thingy. I'm using the onmousedown event but I want to be able to have a default image appear. Can someone help me with my current code or give a totally new concept as to do what I want. You can view this example at www.fearfullymadedesign.com

<IMG SRC="html/images/tshirt-button_02.gif" ALT=" " ONMOUSEdown="document.images['large'].src='html/images/rednwhcapsleeve-ETHB.gif'">
<IMG SRC="html/images/tshirt-button_04.gif" ALT=" " ONMOUSEdown="document.images['large'].src='html/images/gr-ETTHB.gif'">
<IMG SRC="html/images/tshirt-button_05.gif" ALT=" " ONMOUSEdown="document.images['large'].src='html/images/blu-ringer-ETTHB2.gif'">
<IMG SRC="html/images/tshirt-button_06.gif" ALT=" " ONMOUSEdown="document.images['large'].src=''">
<BR><BR>
<IMG SRC="html/images/spacer.gif" ALT=" " NAME="large">

Thanks a million

NB
#1 Player

Replies

Replied 15 Jul 2005 17:42:32
15 Jul 2005 17:42:32 myke black replied:
Hi, what you probably need to do is have a function call onmousedown which can check whether there is an image listed and if not, use the default - something like this:

<IMG SRC="html/images/tshirt-button_02.gif" ALT=" " ONMOUSEdown="showImage('html/images/rednwhcapsleeve-ETHB.gif')">
<IMG SRC="html/images/tshirt-button_04.gif" ALT=" " ONMOUSEdown="showImage('html/images/gr-ETTHB.gif')">
<IMG SRC="html/images/tshirt-button_05.gif" ALT=" " ONMOUSEdown="showImage('html/images/blu-ringer-ETTHB2.gif')">
<IMG SRC="html/images/tshirt-button_06.gif" ALT=" " ONMOUSEdown="showImage('')"> <BR><BR><BR>
<IMG SRC="html/images/spacer.gif" ALT=" " NAME="large">


<script>
function showImage(imgSrc){
    if (imgSrc == ''){
        document.images['large'].src='html/images/default.gif';
    } else {
        document.images['large'].src=imgSrc;
    }
}

</script>

Reply to this topic