I dette særtema ser vi på, hvordan cloud og AI bliver fundamentet for virksomhedernes digitale forretning, og hvordan de nye muligheder for automatisering og forretningsværdi kan udnyttes uden at miste overblik, sikkerhed og menneskelig kontrol.
<% Function AntalFiler (strSti) strFilSti = Server.Mappath(strSti) Set objFSO = Server.CreateObject("Scripting.FileSystemObject") Set objMappe = objFSO.GetFolder(strFilSti)
intAntal = 0 For Each Item in objMappe.Files intAntal = intAntal + 1 Next
AntalFiler = intAntal End Function
Function RandomBG(intInterval) Randomize lngTal = CInt(Rnd() * intInterval)
If lngTal = 0 Then RandomBG = lngTal + 1 Else RandomBG = lngTal End If End Function %> <img src="<%= RandomBG(AntalFiler("img/billeder")) %>.gif">
Det er ikke afprøvet men det skal ca. være noget ligenden dette her:
<% Function AntalFiler (strSti) strFilSti = Server.Mappath(strSti) Set objFSO = Server.CreateObject("Scripting.FileSystemObject") Set objMappe = objFSO.GetFolder(strFilSti)
strFiles = "" For Each Item in objMappe.Files strFiles = strFiles & Item "," Next
Takker det fungerer nogenlunde. - Dog viser den kun det sidst nye billede i mappen og ikke et tilfældigt.... Er der en der kan rette i koden? ____________________________________________________________________ <% '========================================================== ' Method #3: This method is the most work for the server, ' but it allows you to simply drop a new image into the ' image directory specified and it will automatically ' start showing it randomly with the others. '========================================================== ' Set our random images pickup directory. All files in ' this direcotory will be randomly displayed so it's ' important that the directory contain only image files ' that you want to display. Non-image files and files ' that shouldn't be displayed should not be placed into ' this directory. Const IMGS_DIR = "./upload/"
' Variables for our FileSystemObject objects Dim objFSO, objFolderObject, objFileCollection, objFile
' A pair of integers for our random image selection Dim intFileNumberToUse, intFileLooper
' A "handle" to the file we choose to use Dim objImageFileToUse
' A variable to build our image tag Dim strImageSrcText
' Lets see what's in the directory: Set objFSO = Server.CreateObject("Scripting.FileSystemObject") Set objFolderObject = objFSO.GetFolder(Server.MapPath(IMGS_DIR)) Set objFSO = Nothing
Set objFileCollection = objFolderObject.Files Set objFolderObject = Nothing
' Get a count of files and use it to generate a random ' number from 1 to the count. intFileNumberToUse = Int(objFileCollection.Count * Rnd) + 1
' Set up loop control so we exit when we get to the random ' file number we just picked. intFileLooper = 1 For Each objFile in objFileCollection If intFileLooper = intFileNumberToUse Then ' Get a "handle" on the appropriate file Set objImageFileToUse = objFile Exit For End If intFileLooper = intFileLooper + 1 Next
Set objFileCollection = Nothing
' Build our img src tag text strImageSrcText = IMGS_DIR & objImageFileToUse.Name
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.