On my site, I've had a banner on the top of the forums since nearly the start. I did it by including the code in the inc_top.asp file. However, I've always wanted to be able to randomly display different banners. And I wanted to do this with the ability to include different code depending on the banner instead of just randomly displaying an image. So I came up with the code below. It allows you to include not only your image, but any code that goes with it (such as Javascript, etc.).
In inc_top.asp, add the following code below the <body> tag:
<%
randomize
RandomBanner = int (6 * rnd)+1
select case RandomBanner
case "1"
%>Banner 1 code inserted here<%
case "2"
%>Banner 2 code inserted here<%
case "3"
%>Banner 3 code inserted here<%
case "4"
%>Banner 4 code inserted here<%
case "5"
%>Banner 5 code inserted here<%
case else
%>Banner 6 code inserted here<%
end select
%>
You can change the number of banners by altering the int statement to reflect the correct number and adding or deleting the CASES to match. If you want to favor a banner, then you can include it in the case else statement and change the int value to reflect more than the number of banners.
-
*Interested in Radio Control - http://www.rcwebboard.com/*
Edited by - James on 25 February 2001 10:48:07