Need Javascript assistance

Discussion in 'JavaScript' started by txwebdesign, Sep 7, 2005.

  1. #1
    Hello,

    I've probably searched 10 javascript help sites but can't find the code I need - which I thought was pretty basic...

    I have 3 images on a page of a website I am building - each of a different child. When the user rolls over those images, I want a separate image over to the right (the 4th one) to change. The 4th image will basically be a description of each child. There won't be any links - just rollover effects. Can someone help me with this?

    Thanks,
    Beverly :)
     
    txwebdesign, Sep 7, 2005 IP
  2. rederick

    rederick Peon

    Messages:
    128
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #2
    <script type="text/javascript">
    var imgs = new Array("pic1_description.jpg","pic2_description.jpg","pic3_description.jpg");
    function loadMainImg(num) {
    document.getElementById("pic4").src = imgs[num];
    }
    </script>
    <img id="thumb0" height="60" width="45" onmouseover="loadMainImg(0)" src="pic1.jpg"/>
    <img id="thumb1" height="60" width="45" onmouseover="loadMainImg(1)" src="pic2.jpg"/>
    <img id="thumb1" height="60" width="45" onmouseover="loadMainImg(2)" src="pic3.jpg"/>
    <img id="pic4" src="pic4.jpg"/>

    Something like this will work for you i think...
     
    rederick, Sep 9, 2005 IP