Hi, I have this code to randomly select an image from a sequence of fields in my database. Does anyone know if rather than random, one could simply move from one field to the next sequentialy. That would stop the problem of it randomly selecting the same field twice? The idea is that on page refresh the next pic is selected. It works a treat randomly.
I have been told its not possible as how does the webpage remember what the last pic was!
Thanks
Richard
I have been told its not possible as how does the webpage remember what the last pic was!
Code:
<%
If Not rsCard.EOF Then
rsCard.AbsolutePage = intPage
For intRecord = 1 To rsCard.PageSize
CurrentColumn=1
%>
<tr>
<%
Do While CurrentColumn<=5
Dim thumbnail
thumbnail = rsCard("ThumbnailURL")
Dim totalThumbnails
totalThumbnails = 1
If Not IsBlank(rsCard("NewImageOne")) Then
totalThumbnails = 2
If Not IsBlank(rsCard("NewImageTwo")) Then
totalThumbnails = 3
If Not IsBlank(rsCard("NewImageThree")) Then
totalThumbnails = 4
If Not IsBlank(rsCard("NewImageFour")) Then
totalThumbnails = 5
If Not IsBlank(rsCard("NewImageFive")) Then
totalThumbnails = 6
If Not IsBlank(rsCard("NewImageSix")) Then
totalThumbnails = 7
If Not IsBlank(rsCard("NewImageSeven")) Then
totalThumbnails = 8
If Not IsBlank(rsCard("NewImageEight")) Then
totalThumbnails = 9
End If
End If
End If
End If
End If
End If
End If
End If
' randomize()
' Dim pictureNumber
' pictureNumber = CInt((rnd() * totalThumbnails) + 1)
' Change picture every second
Dim pictureNumber
pictureNumber = (second(Time) MOD totalThumbnails) +1
If pictureNumber>totalThumbnails Then
pictureNumber = 1
End If
If pictureNumber = 2 then
thumbnail = rsCard("NewImageOne")
End If
If pictureNumber = 3 then
thumbnail = rsCard("NewImageTwo")
End If
If pictureNumber = 4 then
thumbnail = rsCard("NewImageThree")
End If
If pictureNumber = 5 then
thumbnail = rsCard("NewImageFour")
End If
If pictureNumber = 6 then
thumbnail = rsCard("NewImageFive")
End If
If pictureNumber = 7 then
thumbnail = rsCard("NewImageSix")
End If
If pictureNumber = 8 then
thumbnail = rsCard("NewImageSeven")
End If
If pictureNumber = 9 then
thumbnail = rsCard("NewImageEight")
End If
If IsNull(thumbnail) then
thumbnail = rsCard("ThumbnailURL")
End If
%>
Thanks
Richard
Comment