|
CodeAve.com - ASP - Random Functions | |||
|
|
||||
| Random Hyperlinked Images | ||||
|
|
||||
<% ' Sets the upper limit for the random number limit=7 ' Redim allows for arrays to be setup by passing a numeric value ' rather than hardcoding the numeric value for the limit multiple times redim link(limit) redim image (limit) ' List of images and links link(1)="http://www.yahoo.com" image(1)="http://us.yimg.com/images/yahoo.gif" link(2)="http://www.excite.com" image(2)="http://www.excite.com/mesp/images/excite/new_logo-180.gif" link(3)="http://www.lycos.com" image(3)="http://a284.g.akamai.net/7/284/987/000/lygo.com/ly/i/lyguide.gif" link(4)="http://www.cnet.com" image(4)="http://cnet.com/Images/Headers/cnet-1-title.gif" link(5)="http://www.go.com" image(5)="http://www.go.com/images/hp/go_logo_121_58.gif" link(6)="http://www.webcrawler.com" image(6)="http://webcrawler.com/img/web/hdr/home_header.gif" link(7)="http://www.go.com" image(7)="http://www.go.com/images/hp/go_logo_121_58.gif" ' produces the randome number from 1 to the value of limit randomize random=int(rnd*limit)+1 'Writes the randomly selected hyperlink and image to the browser %> <center> <a href="<%= link(random) %>"> <img src="<%= image(random) %>" border="0"></a>
|
||||
|
|
||||