Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Community Discussions (All other subjects)
 Javascript ?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

JJenson
Advanced Member

USA
2121 Posts

Posted - 21 October 2009 :  21:54:44  Show Profile  Visit JJenson's Homepage  Reply with Quote
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?


<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

JJenson
Advanced Member

USA
2121 Posts

Posted - 21 October 2009 :  22:56:01  Show Profile  Visit JJenson's Homepage  Reply with Quote
Dumb me nevermind forgot to add onload to the body tag. I need sleep.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.18 seconds. Powered By: Snitz Forums 2000 Version 3.4.07