...

Ad rotator javascript

Saber_Ryan1
01-08-2004, 03:09 PM
I've gotten an ad rotator script from a website, but after filling in all the required lines with my URLs, I get an error when trying to view the page some times. Here's what the error says, "A Runtime Error has occurred. Do you wish to Debug? Line: 55 Error: Expected ';'". So there seems to be an error on line 55 - can someone figure out what it is, please?.. Here's the script for you all (with my URLs in it):



<SCRIPT>

// put info for randomly selected banners here, as in the examples

gfx0="http://rcm-images.amazon.com/images/G/01/associates/promotions/b1c-468x60.gif";

lnk0="http://www.amazon.com/exec/obidos/redirect?tag=mgsonline-20&creative=92489&camp=8117&link_code=dl1&path=subst/misc/amazon-cobrand-cc/v3/marketing-from-associates-step1.html/ref%3Db1_assoc_26";

alt0="Amazon.com Platinum Visa Card";

gfx1="http://www.mgsonline.net/home-banner-468x60.gif";

lnk1="http://www.amazon.com/exec/obidos/redirect-home/mgsonline-20";

alt1="In Association with Amazon.com";

gfx2="http://www.cafepress.com/cp/banners/cp_referral_468x60.gif";

lnk2="http://www.cafepress.com/cp/info/storeref.aspx?refby=mgsonline";

alt2="Design and Sell Merchandise Online for Free";

gfx3="http://www.alienware.com/affiliate_pages/banners/gaming_pc_banner_468x60.gif";

lnk3="http://www.alienware.com/index.aspx?from=_R__Y__A__N_:gaming_pc_banner_468x60";

alt3="Alienware - Gaming PC for PC Gaming";

len=4; // change to equal number of banners

today=new Date();

today=today.getTime()/10;

rnd=today%len;

document.writeln('<A HREF="'+eval("lnk"+rnd)+'"><IMG SRC="'+eval("gfx"+rnd)+'" ALT="'+eval("alt"+rnd)+'" WIDTH="468" HEIGHT="60"></A>');

</SCRIPT>


Line 55 (of the HTML document) is, by the way, the line that begins with, "document.writeln". See any problems in that line? Help would be greatly appreciated!

Thanks in advance,

Garadon
01-08-2004, 06:25 PM
<SCRIPT>

// put info for randomly selected banners here, as in the examples
len=4;

gfx=new Array(len);
lnk=new Array(len);
alt=new Array(len);

gfx[0]="http://rcm-images.amazon.com/images/G/01/associates/promotions/b1c-468x60.gif";
lnk[0]="http://www.amazon.com/exec/obidos/redirect?tag=mgsonline-20&creative=92489&camp=8117&link_code=dl1&path=subst/misc/amazon-cobrand-cc/v3/marketing-from-associates-step1.html/ref%3Db1_assoc_26";
alt[0]="Amazon.com Platinum Visa Card";

gfx[1]="http://www.mgsonline.net/home-banner-468x60.gif";
lnk[1]="http://www.amazon.com/exec/obidos/redirect-home/mgsonline-20";
alt[1]="In Association with Amazon.com";

gfx[2]="http://www.cafepress.com/cp/banners/cp_referral_468x60.gif";
lnk[2]="http://www.cafepress.com/cp/info/storeref.aspx?refby=mgsonline";
alt[2]="Design and Sell Merchandise Online for Free";

gfx[3]="http://www.alienware.com/affiliate_pages/banners/gaming_pc_banner_468x60.gif";
lnk[3]="http://www.alienware.com/index.aspx?from=_R__Y__A__N_:gaming_pc_banner_468x60";
alt[3]="Alienware - Gaming PC for PC Gaming";



today=new Date();

today=today.getTime()/10;

rnd=Math.floor(today%len);

document.writeln('<A HREF="'+lnk[rnd]+'"><IMG SRC="'+gfx[rnd]+'" ALT="'+alt[rnd]+'" WIDTH="468" HEIGHT="60"></A>');
</SCRIPT>

Saber_Ryan1
01-09-2004, 05:17 PM
That works perfectly - thanks! :) There's only one thing that I don't like about it, and that is that it puts a big blue border around the images, whereas a different script I found (one that does not allow the description text, unfortunately) does not do so.. Maybe I can get rid of it some how..

Well, thanks again!

Choopernickel
01-09-2004, 06:25 PM
No need to alter the script for that. Use CSS - that's what it's for.

<style type="text/css">
a img { /* any image that's inside an anchor tag */
border: 0 none;
}
</style>

See how much easier?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum