|
Mostrando imágenes al azar
Este ejemplo, muestra la manera de mostrar una
serie de imagenes al azar, cada ver que un usuario ingresa al sitio
web.
Sólo es necesario crear una carpeta pictures y colocar la imagenes
allí.
--<%
dim x(1000)
'La Carpeta de las Imagenes...
Const mypath="pictures/"
Set filesystem = CreateObject("Scripting.FileSystemObject")
Set folder = filesystem.GetFolder(server.mappath(mypath))
Set filecollection = folder.Files
'Listar archivo por archivo...
idx=0
For Each file in filecollection
idx=idx+1
x(idx)=file.name
Next
'Elegir un archivo al azar
randomize timer
whichNo=int(rnd()*idx)+1
'Borrar...
set filesystem=nothing
set folder=nothing
set filecollection=nothing
'Mostrar la Imagen
response.write "<img height=97% src=" & mypath & "/"
response.write x(whichNO)& " alt=" & x(whichNo) & " border=5>"
%>--
|
 |

|