www.webdeveloper.com
Results 1 to 2 of 2

Thread: Dynamic image link

  1. #1
    Join Date
    Nov 2006
    Posts
    13

    Arrow Dynamic image link

    Hi,

    Im having a little problem with my dropdown. It is populated dynamically from images inside a folder.

    I have a 'preview button' next to the dropdown which i would like (when clicked) to popup a window displaying the image in the dropdown.

    I tried making the preview button have code along the lines of:

    <img src="../images/uploaded/+document.getElementById.[imgdropdown].value" />

    however this didnt work.

    Thanks for any help with this!

  2. #2
    Join Date
    Feb 2008
    Posts
    1,666
    HTML Code:
    <img name="preview" src="" />
    <button type="button" onclick="
     var sel = document.getElementById('imgdropdown');
     var img = sel.options[sel.selectedIndex].value;
     document.images['preview'].src = '../images/uploaded/' + img;
     return true;">Preview</button>

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles