12. september 2003 - 09:47Der er
10 kommentarer og 1 løsning
Skift billede dagligt
Asp> IIS> Jeg har brugt for et script der dagligt skifter billeder f.eks. fra 1 til 15. Hvis ikke der er flere billeder startes forfra med billede 1. Billederne ligger i en anden mappe. Evt. i en database. Nogen der har et sådant script liggende?
Der skal være en løkke der får den til at starte forfra. Jeg tænkte også en løkke der tæller op til der ikke er flere billeder. Ex. Hvis #3 findes hvis billede Hvis #3 ikke findes start forfra fra 1
Set fso = CreateObject("Scripting.FileSystemObject") If LEN(Application("Counter")) <= 0 Then Application("Counter") = 1 Application("CounterDate") = Date() End If If Date > Application("CounterDate") Then If (fso.FileExists(Application("Counter") & ".jpg")) Then img = Application("Counter") & ".jpg" Application("Counter") = Application("Counter") + 1 Else img = "1.jpg" Application("Counter") = 1 End If Response.Write "<IMG SRC=""" & img & """>" End If
Så lige, at jeg glemmer at opdatere dato variablen
Set fso = CreateObject("Scripting.FileSystemObject") If LEN(Application("Counter")) <= 0 Then Application("Counter") = 1 Application("CounterDate") = Date() End If If Date > Application("CounterDate") Then If (fso.FileExists(Application("Counter") & ".jpg")) Then img = Application("Counter") & ".jpg" Application("Counter") = Application("Counter") + 1 Else img = "1.jpg" Application("Counter") = 1 End If Application("CounterDate") = Date() Response.Write "<IMG SRC=""" & img & """>" End If
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.