Hey guys. I'm trying to change the image in a container with what I thought was simple javascript, but can't seem to figure it out. "cover-image" is the container where the image is, and "txtMontage" is the ID of the drop down list. If I run this as is, no mater what I select the image is set by the first if statement, and then the drop down gets stuck on it so I can't select anything else.
Any ideas on how to fix this? Thanks.
<script type="text/javascript">
function showPreview() {
var image = document.getElementById("cover-image");
var dropd = document.getElementById("txtMontage");
if (dropd.value = "abrasives") {
var container= "img/abrasives.jpg";
image.src = container;
}
else if (dropd.value = "industrial") {
var container= "img/gen-industrial.jpg";
image.src = container;
}
}
</script>