View Single Post
Old 08-25-2008   #4 (permalink)
notjustgraphics
Rusty Bio-Hazard!
 
notjustgraphics's Avatar
 

Join Date: Sep 2006
Location: Toronto, Ontario, Canada
Posts: 1,161

Send a message via MSN to notjustgraphics
<!-- Banner Ads Rotation Script -->
<!-- The JavaScript Source!! JavaScript Source: Free JavaScripts, Tutorials, Example Code, Reference, Resources, and Help -->
<!-- Adapted for www.thebookforum.com by Darren Lewis-->

<!-- Begin
var how_many_ads = 2;
var ad = Math.ceil(how_many_ads*Math.random());

if (ad==1) {
url="http://www.example1.htm";
alt="Example";
banner="http://www.example.com/example.gif";
width="468";
height="60";
}
if (ad==2) {
url="http://www.example1.htm";
alt="Example";
banner="http://www.example.com/example.gif";
width="468";
height="60";
}
// Output HTML code
document.write('<center>');
document.write('<a href=\"' + url + '\" target=\"_blank\">');
document.write('<img src=\"' + banner + '\" width=')
document.write(width + ' height=' + height + ' ');
document.write('alt=\"' + alt + '\" border=0></a>');
document.write('</center>');
// End -->

The above code change (see red) would be my preferred method for executing a random selection.

It's effectively the same with a few less lines of code.

Both will work however.

Cheers!
__________________
notjustgraphics is offline