JavaScript Change Image

Discussion in 'JavaScript' started by circuscircus, Jan 30, 2007.

Thread Status:
Not open for further replies.
  1. #1
    I have a select with 3 images and when I select the images, I want it to change on the side

    <select name="coolimages" onchange="...%%%..">
    <option value="img1.jpg">Green Flower</option>
    <option value="img2.jpg">Red Flower</option>
    <option value="img3.jpg">Brown Tree</option>
    </select>

    <img src="blank.gif" id="myimage">

    What would go in ...%%%... ?

    Thanks!
     
    circuscircus, Jan 30, 2007 IP
  2. datropics

    datropics Peon

    Messages:
    309
    Likes Received:
    3
    Best Answers:
    1
    Trophy Points:
    0
    #2
    Hi,

    Replace ...%%%... ? with document.getElementById('myimage').src = this.value;

    HTH
     
    datropics, Jan 30, 2007 IP
  3. rays

    rays Active Member

    Messages:
    563
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    58
    #3
    datropics is absolutely correct ... it must work for you

    cheers friends
     
    rays, Jan 31, 2007 IP
Thread Status:
Not open for further replies.