Random background-When you go to the page, randomly select a picture from the designated picture folder to display as a background. The method described here is implemented using ASP CSS.
Asp
Here is a quote fragment: Const Imgs_dir = "/images"
' Set the address of the picture folder and randomly display any picture in the folder
The following are the referenced contents:
Dim objFSO, Objfolderobject, Objfilecollection, objfile
Dim Intfilenumbertouse, Intfilelooper
Dim Objimagefiletouse
Dim Strimagesrctext
Set objFSO = Server.CreateObject ("Scripting.FileSystemObject")
Set objfolderobject = Objfso.getfolder (Server.MapPath (Imgs_dir))
Set objFSO = Nothing
Set objfilecollection = Objfolderobject.files
Set Objfolderobject = Nothing
Randomize ()
Intfilenumbertouse = Int (Objfilecollection.count * Rnd) 1
Intfilelooper = 1
For each objfile in Objfilecollection
If Intfilelooper = Intfilenumbertouse Then
Set Objimagefiletouse = objfile
Exit for
End If
Intfilelooper = intfilelooper 1
Next Set objfilecollection = Nothing
Strimagesrctext = Imgs_dir |