Hi guys,
I'm trying to create a targeted ad script that loads a specific ad into an iframe when 'onChange' occurs in a select box (or 'onClick' of submit button-haven't decided yet). My problem is: I can get the ad to load into the frame no-problem, but my conditional statement is skipped alltogether. I have tested with alerts and the function is returning checkbox states (true/false) etc & values are being returned from the select box. Doesn't matter what I do ANY selection causes the ad to load into the iframe.
Please help, I only have a few hairs left.......
Here's the script - I have no idea if I've written it correctly, I've only been at this a couple of weeks.
- <script>
-
-
-
-
function changeAd(){ //this function being called from select box with: 'onChange=changeAd()'
-
-
var currentSel = document.getElementById("selection").value; //dropdown select box with ID of selection
-
var duff = document.getElementById("duff").checked; //checkbox with ID of 'duff'
-
var well = document.getElementById("well").checked; //checkbox with ID of 'well'
-
-
-
-
if (duff == true && currentSel == "Alarm Systems and Monitoring"); //this statement is being ignored.
-
{
-
document.getElementById("adbox").src = "ads/ad5.jpg"; //this IS occurring regardless of selection
-
} //the entire script is acting like: onChange=document.getElementById("adbox").src = "ads/ad5.jpg";
-
}
-
</script>