Chnaging Displayed Image on a Webpage Using Javascript
- by Gavin
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