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
%>
<script>
var counter=0
var fadeimages=new Array()
</script>
<%

'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
%>
<script>
fadeimages[counter]=["images/"<%=CustomerId%>/"<%= objItem.Name %>", "", ""]

counter++
</script>
<%
End If
Next 'objItem

' All done!  Kill off our asp object variables.
Set objItem = Nothing
Set objFolder = Nothing
Set objFSO = Nothing
Set RegExObj = Nothing
%>

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 %>", "", ""]

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.