From Newsgroup: comp.lang.javascript
<script type="text/javascript" src="randomAds3.js"></script>
<script type="text/javascript" src="randomAds2.js"></script>
</head>
<body>
<div
style=display:block;float:left;margin-left:0px;margin-right:0px;margin-to p:10px;margin-bottom:10px;>
<script type="text/javascript">
randomorder(adblock3, ' ')
</script></div><br><br><br><br><br><br>
<div
style=display:block;float:right;margin-left:0px;margin-right:0px;margin-t op:10px;margin-bottom:10px;>
<script type="text/javascript">
randomorder(adblock2, ' ')
</script></div>
I'm trying to get two different random ad banners working on the same
page(s) of my site. The first one (randomads3.js) is a 728x90
leaderboard at the top, and the other one (randomads2.js) is a 60x600 skyscraper further down the page.
As you can see I put the script type for the two banners above the
<head>, then the adblock for the first one below the <body> at the top,
and the adblock for the other one further down the page.
Both ads are displaying, but for some reason the top banner
(randomAds3.js) is loading two banners from the same folder, one below
the other, and I only want one banner of this type to display.
Can anyone tell me how to fix this?
Thanks in advance.
P.S.: here is the content of the two random ads .js files if that helps:
var adblock2=new Array()
adblock2[0]='<a href="
https://amzn.to/3JzgVJj"><img src="
https://www.(my domain)/random_ads2/amazon_books.jpg" class="imgBorder"></a>'
adblock2[1]='<a href="
https://amzn.to/3Nn9AOH"><img src="
https://www.(my domain)/random_ads2/amazon_winter_sale.jpg" class="imgBorder"></a>' adblock2[2]='<a href="
https://amzn.to/3MxfufY"><img src="
https://www.(my domain)/random_ads2/amazon_groceries.jpg" class="imgBorder"></a>' adblock2[3]='<a href="
https://amzn.to/47QaICJ"><img src="
https://www.(my domain)/random_ads2/amazon_prime.jpg" class="imgBorder"></a>'
adblock2[4]='<a href="
https://amzn.to/4b7a3ys"><img src="
https://www.(my domain)/random_ads2/amazon_music_unlimited.jpg" class="imgBorder"></a>' adblock2[5]='<a href="
https://amzn.to/4qjRxrR"><img src="
https://www.(my domain)/random_ads2/amazon_essentials.jpg" class="imgBorder"></a>'
function randomorder(targetarray, spacing) {
var randomorder=new Array()
var the_one
var z=5
for (i=0;i<targetarray.length;i++)
randomorder[i]=i
while (z<targetarray.length) {
the_one=Math.floor(Math.random()*targetarray.length)
if (targetarray[the_one]!="_selected!"){
document.write(targetarray[the_one]+spacing)
targetarray[the_one]="_selected!"
z++
}
}
}
var adblock3=new Array()
adblock3[0]='<a href="
https://7c461dt6-gnefxa897w21gxpbj.hop.clickbank.net"><img src="
https://www.(my domain)/random_ads3/killer_guitar_control.gif" class="imgBorder"></a>'
adblock3[1]='<a href="
http://rocksite.miamiink.hop.clickbank.net"><img src="
https://www.(my domain)/random_ads3/miami_ink.gif" class="imgBorder"></a>'
adblock3[2]='<a href="
https://4a7e1nq4ldxhlx0jxp0a679q3z.hop.clickbank.net"><img src="
https://www.(my domain)/random_ads3/mitolyn.gif"
class="imgBorder"></a>'
adblock3[3]='<a href="
https://hop.clickbank.net/?affiliate=rocksite&vendor=singorama"><im
g src="
https://www.(my domain)/random_ads3/singorama.gif" class="imgBorder"></a>'
adblock3[4]='<a href="
https://416ccqxzmhlhqk9fm6xkkwqjab.hop.clickbank.net"><img src="
https://www.(my domain)/random_ads3/piano_for_all.gif" class="imgBorder"></a>'
adblock3[5]='<a href="
https://d6d4bnu6lgkrtw9l3il3-aqc8a.hop.clickbank.net"><img src="
https://www.(my domain)/random_ads3/real_life_defense.gif" class="imgBorder"></a>'
adblock3[6]='<a href="
https://hop.clickbank.net/?affiliate=rocksite&vendor=thoughtop"><im
g src="
https://www.(my domain)/random_ads3/moon_reading.gif" class="imgBorder"></a>'
function randomorder(targetarray, spacing) {
var randomorder=new Array()
var the_one
var z=6
for (i=0;i<targetarray.length;i++)
randomorder[i]=i
while (z<targetarray.length) {
the_one=Math.floor(Math.random()*targetarray.length)
if (targetarray[the_one]!="_selected!"){
document.write(targetarray[the_one]+spacing)
targetarray[the_one]="_selected!"
z++
}
}
}
--- Synchronet 3.21b-Linux NewsLink 1.2