<html>
<head>
<%
Dim fso
Set fso = Server.CreateObject("Scripting.FileSystemObject")
Dim rootFolder
Set rootFolder = fso.GetFolder(Server.MapPath("/mywebfolder/images/"))
Dim files
Set files = rootFolder.Files
' Write the javascript header
response.write "<SCR" & "IPT LANGUAGE=""JavaScript"">" & vbCrlf
' then declare the array
response.write "var arrImages = new Array();" & vbCrlf
outstr="arrImages = ["
For Each file in files
If file.Type = "GIF Image" OR file.type = "JPG Image" Then
' Store filename in Client Side Javascript array arrImages
If cnt <> 0 then
outstr = outstr & ","
End if
cnt=cnt+1
outstr = outstr & "'" & file.Name & "'"
End If
Next
outstr = outstr & "];" & vbCrLf
response.write outstr
' write the script trailer...
Response.Write "</SCR" & "IPT>" & vbCrlf
Set files = Nothing
Set rootFolder = Nothing
Set fso = Nothing
%>
<script language="javascript">
for (var loop=0;loop<arrImages.length;loop++)
{
document.write(arrImages[loop] + "<br>");
}
</script>
</head>
<body>
</body>
</html>