Hi ASP Masters,
I'm not too good on JavaScript but I have an ASP slide Show that's not working.
Can any one directs me to the right solution please as the pictures folder is according to the CustomerID - many thanks.

' The Runtime code:
' Create some asp variables for
Dim strPath   'Path of directory
Dim objFSO    'FileSystemObject variable
Dim objFolder 'Folder variable
Dim objItem   'Variable used to loop through the contents of the folder

' You could just as easily read this from some sort of input
' NOTE: As currently implemented, this needs to end with the /
strPath = "images\" & CustomerId

' Create our FSO
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")

' Get a handle on our folder
Set objFolder = objFSO.GetFolder(Server.MapPath(strPath))

'Create some javascript variables
var counter=0
var fadeimages=new Array()

'Selecting only images
Set RegExObj = New RegExp
With RegExObj
.Pattern = "gif|jpg|png"
.IgnoreCase = True
End With
For Each objItem In objFolder.Files
If RegExObj.Test(Right(objItem.Name, 3)) Then
'Add each one to the array using javascript
fadeimages[counter]=["images/"<%=CustomerId%>/"<%= objItem.Name %>", "", ""]

End If
Next 'objItem

' All done!  Kill off our asp object variables.
Set objItem = Nothing
Set objFolder = Nothing
Set objFSO = Nothing
Set RegExObj = Nothing
7 Years
Discussion Span
Last Post by hielo

On line 11 you are using CustomerId, but it is NOT initialized yet. You need to initialize it first.

Also, try changing line 38 to: fadeimages[counter]=["images/<%=CustomerId & "/" & objItem.Name %>", "", ""]

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.