Welcome Guest [Log In] [Register]
This board has been archived and is no longer accepting new questions. If you have a support question for your ZetaBoard, please visit us at the new support board. Registration is free and easy.


Visit the NEW ZetaBoards Support forum!

Username:   Password:
Add Reply
Random Banner Ad Code ?
Topic Started: Feb 28 2008, 06:51 PM (1,680 Views)
Direct-Adverts
Direct-Adverts.com (JOIN UP)
[ * ]
hi there is there a code, where a random banner shows up like this

http://img235.imageshack.us/img235/1155/advertismentrottr8.png

the middle pic shows a random banner with every page refresh
Offline Profile Quote Post Goto Top
 
Viral
Member Avatar
i'm stanley nao
[ *  *  *  *  * ]
Code: HTML
 
<script type="text/javascript">
//<![CDATA[
ads=[];n=0
ads[n++]=["link","image"];
ads[n++]=["link","image"];
num=Math.floor(Math.random()*ads.length);
document.write("<center><a href='"+ads[num][0]+"'><img src='"+ads[num][1]+"'/></a></center>");
//]]>
</script>
Offline Profile Quote Post Goto Top
 
Direct-Adverts
Direct-Adverts.com (JOIN UP)
[ * ]
so where is the border, for the mini banner to sit in ? i want it like the pic, so the middle mini banner changes
Offline Profile Quote Post Goto Top
 
Thunder
Member Avatar
Thunder
[ *  *  * ]
Viral
 
<script type="text/javascript">//<![CDATA[ads=[];n=0ads[n++]=["link","image"];ads[n++]=["link","image"];num=Math.floor(Math.random()*ads.length);document.write("<center><a href='"+ads[num][0]+"'><img src='"+ads[num][1]+"'/></a></center>");//]]></script>


Viral: Which part of this code makes things random, instead of just one?
Offline Profile Quote Post Goto Top
 
.Richard
Member
[ * ]
Quote:
 
<script type="text/javascript">
//<![CDATA[
ads=[];n=0
ads[n++]=["link","image"];
ads[n++]=["link","image"];
num=Math.floor(Math.random()*ads.length);
document.write("<center><a href='"+ads[num][0]+"'><img src='"+ads[num][1]+"'/></a></center>");
//]]>
</script>
To make Viral's code work just change the red to the link and the green to the image and if you need to add more add this below the 2nd one:
Code:
 
ads[n++]=["link","image"];
Offline Profile Quote Post Goto Top
 
Viral
Member Avatar
i'm stanley nao
[ *  *  *  *  * ]
Code: HTML
 
num=Math.floor(Math.random()*ads.length);


That's the randomness.
Offline Profile Quote Post Goto Top
 
obxbiker
Member Avatar
U.S.M.C.R.
[ *  *  * ]
Would an off site host that offers random images work ?
http://www.imageox.com/index.php
Offline Profile Quote Post Goto Top
 
Viral
Member Avatar
i'm stanley nao
[ *  *  *  *  * ]
With those things, you just insert the image URL they give you, and it does the random stuff for you.
Offline Profile Quote Post Goto Top
 
hika
Member
[ * ]
i don't understand.
so, where i must put that code on my board?
in the board wrappers? or in the javascript?
Offline Profile Quote Post Goto Top
 
Viral
Member Avatar
i'm stanley nao
[ *  *  *  *  * ]
Wherever you want the banner to appear.
Offline Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · Theme & Code Help · Next Topic »
Add Reply