The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Why does this code work there but not here?
So I'm using the exact same code for rotating banners on my regular html cover page site (http://www.wartornnations.net/) and for my vBulletin 3.8.3 too (http://www.wartornnations.net/forum/).
It rotates just fine on the html site but it rotates sporadically only when I refresh the vBulletin site. What in the vBulletin code would hang up such a simple banner rotation code? Any help is appreciated. The code follows: HTML SITE CODE: Code:
<html> <head> <title>www.wartornnations.net</title> </head> <body> <DIV ALIGN=CENTER> <script language="JavaScript"> <!-- function adArray() { for (i=0; i*2<adArray.arguments.length; i++) { this[i] = new Object(); this[i].src = adArray.arguments[i*2]; this[i].href = adArray.arguments[i*2+1]; } this.length = i; } function getAdNum() { dat = new Date(); dat = (dat.getTime()+"").charAt(8); if (dat.length == 1) ad_num = dat%ads.length; else ad_num = 0; return ad_num; } var ads = new adArray( "http://d2ysc6lw6qcd4g.cloudfront.net/728x90-proudly-support.jpg", "http://www.woundedwarriorproject.org/", "http://www.veteranscrisisline.net/banners/public/ads/VeteransCrisisLine-728x90-1-Static.gif", "http://www.veteranscrisisline.net/" ); var ad_num = getAdNum(); document.write('<table cellpadding=0 cellspacing=1 border=0><tr><td ' +'align="left">' +'<A href="'+ads[ad_num].href+'"><IMG SRC="'+ads[ad_num].src+'" ' +'height="60" width="468" border="0" name="js_ad"></a></td></tr></table>'); link_num = document.links.length-1; function rotateBanner() { if (document.images) { ad_num = (ad_num+1)%ads.length; document.js_ad.src = ads[ad_num].src; document.links[link_num].href = ads[ad_num].href; setTimeout("rotateBanner()",5000); } } setTimeout("rotateBanner()",5000); // --> </script> </DIV> </body> </html> Code:
<html> <head> <title>UKBL ~ 10 Second Banner Rotator</title> </head> <body> <DIV ALIGN=CENTER> <script language="JavaScript"> <!-- function adArray() { for (i=0; i*2<adArray.arguments.length; i++) { this[i] = new Object(); this[i].src = adArray.arguments[i*2]; this[i].href = adArray.arguments[i*2+1]; } this.length = i; } function getAdNum() { dat = new Date(); dat = (dat.getTime()+"").charAt(8); if (dat.length == 1) ad_num = dat%ads.length; else ad_num = 0; return ad_num; } var ads = new adArray( "http://d2ysc6lw6qcd4g.cloudfront.net/728x90-proudly-support.jpg", "http://www.woundedwarriorproject.org/", "http://www.veteranscrisisline.net/banners/public/ads/VeteransCrisisLine-728x90-1-Static.gif", "http://www.veteranscrisisline.net/", "http://firstrespondersomaha.org/wp-content/uploads/2015/03/TrueBlue-728x90.gif", "http://firstrespondersomaha.org/support-blue-materials/" ); var ad_num = getAdNum(); document.write('<table cellpadding=0 cellspacing=1 border=0><tr><td ' +'align="left">' +'<A href="'+ads[ad_num].href+'"><IMG SRC="'+ads[ad_num].src+'" ' +'height="90" width="728" border="0" name="js_ad"></a></td></tr></table>'); link_num = document.links.length-1; function rotateBanner() { if (document.images) { ad_num = (ad_num+1)%ads.length; document.js_ad.src = ads[ad_num].src; document.links[link_num].href = ads[ad_num].href; setTimeout("rotateBanner()",5000); } } setTimeout("rotateBanner()",5000); // --> </script> </DIV> </body> </html> |
#2
|
||||
|
||||
You didn't add the <html> and <body> and <head> tags (and other tags that go with those) into the header, did you? You are going to break the html on your site if you don't just add the javascript for it into the header template.
|
Благодарность от: | ||
COOLORANGEFREEZ |
#3
|
|||
|
|||
I did add those.
I will take them out and reassess later this eve. Thanks for the quick response. |
#4
|
||||
|
||||
After you change it, run the page through here and see if there are any errors related to any of the code you added - http://validator.w3.org/
|
Благодарность от: | ||
TheLastSuperman |
#5
|
|||
|
|||
Way overdue... thank you for your suggestion. It worked.
|
Благодарность от: | ||
TheLastSuperman |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|