wide_eyed
05-24-2005, 04:32 PM
I was hoping someone could help me with this. What I’m tiring to accomplish is to have several hyperlinked images with alt tags and no border, displayed in a table randomly but not repeated.
I found a script that will display unique random numbers:
<html>
<title>Codeave.com(Unique Random Numbers)</title>
<body bgcolor="#FFFFFF">
<%
' Determines how many unique random numbers to be produced
tot_unique=5
' Determines the highest value for any unique random number
top_number=5
dim random_number, counter, check, unique_numbers
' When passing a varible for an array use redim
redim random_number(tot_unique)
' begin random function
randomize
' Begin a for next loop from one to the max number of unique numbers
For counter = 1 to tot_unique
' select a number between 1 and the top number value
random_number(counter) = Int(Rnd * top_number)+1
' For next loop to compare the values stored in the array to
' the new random value being assigned
for check=1 to counter-1
if random_number(check)= random_number(counter) then
' If the current value is equal to a previous value
' subject
counter=counter-1
end if
next ' Repeat loop to check values
next ' Repeat loop to assign values to the array
%>
<p>
<ol><% 'write out the unique numbers in a list for display
For counter = 1 to tot_unique
response.write "<li>" & random_number(counter) & "</li>"
next
%>
</ol>
</body>
</html>
Does anyone know how to apply that concept to images?
I also found a script that will display a single random image:
<%
' 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)
redim alt(limit)
' List of images and links
link(1)="http://www.yahoo.com"
image(1)="http://us.yimg.com/images/yahoo.gif"
alt(1)="Alt Text"
link(2)="http://www.excite.com"
image(2)="http://www.excite.com/mesp/images/excite/new_logo-180.gif"
alt(2)="Alt Text"
link(3)="http://www.lycos.com"
image(3)="http://a284.g.akamai.net/7/284/987/000/lygo.com/ly/i/lyguide.gif"
alt(3)="Alt Text"
link(4)="http://www.cnet.com"
image(4)="http://cnet.com/Images/Headers/cnet-1-title.gif"
alt(4)="Alt Text"
link(5)="http://www.go.com"
image(5)="http://www.go.com/images/hp/go_logo_121_58.gif"
alt(5)="Alt Text"
link(6)="http://www.webcrawler.com"
image(6)="http://webcrawler.com/img/web/hdr/home_header.gif"
alt(6)="Alt Text"
link(7)="http://www.go.com"
image(7)="http://www.go.com/images/hp/go_logo_121_58.gif"
alt(7)="Alt Text"
' 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" alt="<%=alt(random) %>"></a>
The outcome I’m looking for is similar to the above but I want to display several images in a table at once randomly but not repeated.
Any help would be appreciated.
I found a script that will display unique random numbers:
<html>
<title>Codeave.com(Unique Random Numbers)</title>
<body bgcolor="#FFFFFF">
<%
' Determines how many unique random numbers to be produced
tot_unique=5
' Determines the highest value for any unique random number
top_number=5
dim random_number, counter, check, unique_numbers
' When passing a varible for an array use redim
redim random_number(tot_unique)
' begin random function
randomize
' Begin a for next loop from one to the max number of unique numbers
For counter = 1 to tot_unique
' select a number between 1 and the top number value
random_number(counter) = Int(Rnd * top_number)+1
' For next loop to compare the values stored in the array to
' the new random value being assigned
for check=1 to counter-1
if random_number(check)= random_number(counter) then
' If the current value is equal to a previous value
' subject
counter=counter-1
end if
next ' Repeat loop to check values
next ' Repeat loop to assign values to the array
%>
<p>
<ol><% 'write out the unique numbers in a list for display
For counter = 1 to tot_unique
response.write "<li>" & random_number(counter) & "</li>"
next
%>
</ol>
</body>
</html>
Does anyone know how to apply that concept to images?
I also found a script that will display a single random image:
<%
' 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)
redim alt(limit)
' List of images and links
link(1)="http://www.yahoo.com"
image(1)="http://us.yimg.com/images/yahoo.gif"
alt(1)="Alt Text"
link(2)="http://www.excite.com"
image(2)="http://www.excite.com/mesp/images/excite/new_logo-180.gif"
alt(2)="Alt Text"
link(3)="http://www.lycos.com"
image(3)="http://a284.g.akamai.net/7/284/987/000/lygo.com/ly/i/lyguide.gif"
alt(3)="Alt Text"
link(4)="http://www.cnet.com"
image(4)="http://cnet.com/Images/Headers/cnet-1-title.gif"
alt(4)="Alt Text"
link(5)="http://www.go.com"
image(5)="http://www.go.com/images/hp/go_logo_121_58.gif"
alt(5)="Alt Text"
link(6)="http://www.webcrawler.com"
image(6)="http://webcrawler.com/img/web/hdr/home_header.gif"
alt(6)="Alt Text"
link(7)="http://www.go.com"
image(7)="http://www.go.com/images/hp/go_logo_121_58.gif"
alt(7)="Alt Text"
' 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" alt="<%=alt(random) %>"></a>
The outcome I’m looking for is similar to the above but I want to display several images in a table at once randomly but not repeated.
Any help would be appreciated.