shibby
03-04-2002, 03:51 AM
This doesn't really have anyhting to do with hosting, but I figured I would ask it in here because there are so many smart people. :)
I use a banner-rotation script on my site to, well, rotate banners. This is the one I use..
http://www.simplythebest.net/info/javascript69.html
Now, on there it is set up for 5 different banners. Can someone please tell me how to make it for, lets say, only 3 banners? I want all my advertisers to get the same airtime. I tried changing some numbers and stuff, but it didn't seem to work right. I would really appreciate it if one of you could take a look and tell me EVERYTHING that has to be modified in the script so it works properly with 3 banners. Thank you very much! WHT is the BEST! :)
Even more clever people hang out in the Technical & Security Issues area.
Lats...
serve-you
03-04-2002, 04:00 AM
I haven't tried, but looking at the script you should be able to just change all the 5's to 3's, and remove the ads[4] & adds[5] sections.
-Dan
shibby
03-04-2002, 05:35 PM
I'm pretty sure I tried that, cause it was the most obvious, but it still didnt work right. Thanks for you help though. Anyone else have any ideas? :(
DWood
03-04-2002, 05:43 PM
i will enlighten you as to what i use.
<script language="javascript">
<!--
var b1dis = "<a href=\"";
var bdis = "\" target=\"_blank\"><img src=\"";
var edis = " width=\"200\" height=\"110\" alt=\"Advertisement\" border=\"0\"></a>";
var rnumb = "";
var img = "";
rnumb += Math.floor(Math.random()*1);
img = rnumb;
if (img == "0") {
document.write(b1dis+ "http://www.internet-esq.com/lax/photos.htm" +bdis+ "images/featad/laxphotos.gif\"" +edis);
}
// -->
</script>
the number at the end of rnumb is the number of images. it is completely random. just add if statements for each additional one. The first img = "0"
Daniel
Jedito
03-04-2002, 05:45 PM
I'm not a jave programmer, but how about if you change
ads = new Array()
for(var i=1; i<=5; i++) { ads[i] = new create() }
To
ads = new Array()
for(var i=1; i<=3; i++) { ads[i] = new create() }
And
var n = Math.random() + ''
n = parseInt(n.charAt(5))
if(n >5) {
n = n - 5
}
else if(n==0) {
n = n + 5
}
to
var n = Math.random() + ''
n = parseInt(n.charAt(3))
if(n >3) {
n = n - 3
}
else if(n==0) {
n = n + 3
}
As I said, I'm not a programmer, its just an idea :)
AL-Benjamin
03-04-2002, 06:24 PM
ok, i have never really understood javascript only banner rotation. Why have you chosen this over php or cgi based versions?
DWood
03-04-2002, 09:16 PM
only because that is what i got before i had php, and it works very well. it is very simple......in the if statement just change the first thing inside quotes to the url you want it linked to, the second is the image location.
AL-Benjamin
03-04-2002, 09:22 PM
surely now you have php, the options kind of out way any gain from js