roadmap Posted August 20, 2006 Posted August 20, 2006 Below I have 2 scripts, I was wondering if some one could write the second script into the first one? I've tried but each attempt fails. The first is a google ad block for 468x60 ads the second is a javascript ad rotator. <?phpif (eregi("block-GoogleBanner.php",$PHP_SELF)) { Header("Location: index.php"); die(); } ?> <script language="JavaScript"> <!-- google_ad_client = "mycode"; google_ad_width = 468; google_ad_height = 60; google_ad_format = "468x60_as"; google_ad_type = "text_image"; google_ad_channel =""; //--> </script> <?php $content .= "<center><script language=\"JavaScript\" src=\"http://pagead2.googlesyndication.com/pagead/show_ads.js\">"; $content .= "</script></center>"; ?> <script language="JavaScript"><!-- Begin rnd.today=new Date(); rnd.seed=rnd.today.getTime(); function rnd() { rnd.seed = (rnd.seed*9301+49297) % 233280; return rnd.seed/(233280.0); }; function rand(number) { var result = Math.ceil(rnd()*number); if (!result)result++; return result }; var ad_cnt2 = 2; var ad2 = rand(ad_cnt2); var link2; var adBanner2; var width2 var height2 if (ad2==1) { link2="http://affiliates.phpfox.com/idevaffiliate.php?id=252_0_1_7"; adBanner2="http://affiliates.phpfox.com/banners/468x60_02.gif"; width2="468"; height2="60"; alt2="Your own myspace!"; } if (ad2==2) { link2="http://www.mysite/ads/treasure.gif"; adBanner2="http://www.treasuretrooper.com/141751"; width2="468"; height2="60"; alt2="Make money online"; } document.write('<center><a href="' + link2 + '" target="_blank">'); document.write('<img src="' + adBanner2 + '" width=' + width2 + ' height=' + height2 + ' border=0 alt="' + alt2 + '"></a>'); document.write('</center>'); // End --> </SCRIPT> Quote
TCH-Tim Posted August 20, 2006 Posted August 20, 2006 The title is a bit confused - the first snippet is PHP, but the second snippet is Javascript. You can't just mix them together. What is it you are trying to accomplish here? Rotate your Google ads? Quote
roadmap Posted August 20, 2006 Author Posted August 20, 2006 No, I messed up. I want the google info out and I want the bottom script in. The bottom banner rotation javascript would be in the block instead. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.