Javascript ? - Posted (1107 Views)
Advanced Member
JJenson
Posts: 2121
2121
Alright I am trying to swap an image out and for the life of me I think this should work but it doesn't and I cannto figure out why can anyone else spot it?
Code:

<script language="javascript" type="text/javascript">

function gup(name) { name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]"); var regexS = "[\\?&]" + name + "=([^#]*)"; var regex = new RegExp(regexS); var results = regex.exec(window.location.href); if (results == null) return ""; else return results[1]; }


function setimg() {

adclicked = gup('ad');
if (adclicked == 'Oil')
document.getElementById('CouponPicture').src = 'images/OilAd.png';
if (adclicked == 'Radiator')
document.getElementById('CouponPicture').src = 'images/Radiator.gif';
if (adclicked == 'Windshield')
document.getElementById('CouponPicture').src = 'images/Windshield.gif';
if (adclicked == 'Headlights')
document.getElementById('CouponPicture').src = 'images/Headlights.gif';
}

</script>

This is the image in the page its supposed to be updating:

<img src="images/OilAd.png" id="CouponPicture" alt="Click to Print Special!" /></a>

Thanks for the help.
Jeff
 Sort direction, for dates DESC means newest first  
 Page size 
Posted
Advanced Member
JJenson
Posts: 2121
2121
Dumb me nevermind forgot to add onload to the body tag. I need sleep.
 
You Must enter a message