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 affiliate
Topic Started: Mar 14 2008, 01:46 PM (856 Views)
Trav
Member
[ * ]
Thsi is from someone elses code, but I've been trying to make it so it shows an iframe of the random link. Any idea what I'm doing wrong?
And btw I was putting this in a Website (like from the Website Maker tool)

Code:
 
<script type="text/javascript">
//<![CDATA[
ads=[];n=0
ads[n+]=["http://google.com/"];
ads[n+]=["http://google.ca"];
num=Math.floor(Math.random()*ads.length);
document.write("<center>Random Ad<br><iframe src='"+ads+"' width="100%" height="100%" ></iframe></center>");
//]]>
</script>
Offline Profile Quote Post Goto Top
 
mike_p
Member
[ * ]
I would guess you should have put +ads[num]+ in the line starting 'document.write'
instead you put +ads+


-----
edited to say...

ooops! i hadn't noticed how old this thread was - I was just trying to answer some unresolved questions!
Edited by mike_p, Jun 26 2008, 09:05 AM.
Offline Profile Quote Post Goto Top
 
Jayw
Member
[ * ]
Here add this.... (Random banner ad code from a post where Viral posted it.)


Quote:
 

<center>Random Ad</center>
<br/>
<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
 
Viral
Member Avatar
i'm stanley nao
[ *  *  *  *  * ]
It's actually quicker by a few milliseconds if you use it like this:

Code: HTML
 
<center>Random Ad</center>
<br/>
<script type="text/javascript">
//<![CDATA[
ads=[];n=0
ads[n++]=["link","image"];
ads[n++]=["link","image"];
with(Math){var num=floor(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
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · Theme & Code Help · Next Topic »
Add Reply