Chnaging Displayed Image on a Webpage Using Javascript

Posted by Gavin on Stack Overflow See other posts from Stack Overflow or by Gavin
Published on 2011-02-25T15:23:33Z Indexed on 2011/02/25 15:25 UTC
Read the original article Hit count: 435

Filed under:
|
|

Hi all,

I'm having some trouble changing an image being displayed on a page by way of a dropdown menu selection.

This works fine.. getting the dropdown menu to give me an alert when I make a selection. Even though the menu is embedded within a division, paragraph, and label tag, it still works. "availableImages" is the name of my menu.

function imageSelect() { var index = document.getElementById("myForm").availableImages.selectedIndex;
var value = document.getElementById("myForm").availableImages.options[index].value;

alert("test " + value); // alert box pops up upon list item selection }

However, within the same division, I am having an issue with changing the source of my image tag... Any ideas? I will provide more code if it will be helpful.

Thanks! Gavin

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about image