I want to be able to change the image depending on what is selected in the drop-down list ...
I have JS code to change the image. Simplified, of course.
<script type="text/javascript">
function changeImage()
{
var oDDL = document.all("ddlNAME");
var NAME= oDDL.options[oDDL.selectedIndex].text;
switch(NAME)
{
case "Name":
document.getElementById("img").src="img1.png";
break;
case "Name2":
document.getElementById("img").src="img2.png";
break;
default:
document.getElementById("img").src="img3.png";
}
}
</script>
When I call this function, I do this in my DDL implementation.
<asp:DropDownList ID="ddlNAME" runat="server" OnTextChanged="changeImage()" >
But for some reason changeImage()does not shoot. it gives me an error saying
'changeImage' is not a member of 'ASP.default_aspx'
I know this is a question about noob, and it's something small ... But this is my first day, each of which uses javascript, so please bring it with me. Thank!
source
share