Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

banner rotation

Status
Not open for further replies.

skinster

Programmer
Joined
Feb 5, 2003
Messages
3
Location
CA
I have 3 banners being displayed but I dont want to display the same one twice how would i go abot that.
here is my code

Thanx aj

banpic = new Array();
banurl = new Array();

banpic[1]="banpic[2]="banpic[3]="banpic[4]="banpic[5]="banpic[6]="
banurl[1]="banurl[2]="banurl[3]="banurl[4]="banurl[5]="banurl[6]="
function getban(){
var language = document.all ? navigator.userLanguage : navigator.language;
lang=0;
if( language && language.indexOf( "nl" ) != -1 ){
lang=3;
}

if(lang == 0){
banpicnum=rand(banpic.length-1);

return(&quot;<a href=javascript:banlink('&quot;+banurl[banpicnum]+&quot;')><img border=0 vspace=0 hspace=0 src=&quot;+banpic[banpicnum]+&quot;></a>&quot;);
}
if(lang == 3){
banpicnum=rand(banpic_nl.length-1);
return(&quot;<a href=javascript:banlink('&quot;+banurl_nl[banpicnum]+&quot;')><img border=0 vspace=0 hspace=0 src=&quot;+banpic_nl[banpicnum]+&quot;></a>&quot;);
}

calling banner function

<script>document.write(getban())</script>
 
Must it be a random selection? What's wrong with cycling through them in order? You could still pick a random banner with which to start, but then subsequently sequence through. Besides, your advertisers would probably appreciate knowing that they'll see more-or-less guaranteed 1/x coverage for x banners.

Cheers,

Edward &quot;Cut a hole in the door. Hang a flap. Criminy, why didn't I think of this earlier?!&quot; -- inventor of the cat door
 
Yes that would be good but How would I go about that Sorry for asking,I'm Pretty new at javascript

Thanx aj
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top