Contrary to popular belief, VBScript is
not "used for server-side scripting." VBScript has many uses, and client-side scripting is one of them. Of course it is very true that using client VBScript can limit your web page's audience drastically. That's the best reason to stick with JavaScript on the client: public web pages.
I'm not exactly sure what you mean by wanting to populate an array with pictures. Since the <img> element loads pictures via its
attribute anyway, maybe you mean storing an array of URLs to the actual image files?
Then again, for smooth operation it is common for people to "preload" images in JavaScript. The JavaScript syntax:
... isn't such a wonder as many think it is. The advantage is that it does offer a browser-independent way to do something offered by Internet Explorer through the DOM already though.
In any case, here is a quick and dirty conversion of a JavaScript slideshow page I found
into VBScript for IE. It both preloads the images and stores URL strings in an array as I described. As noted in the comments, I got it from CodeLifter.com:
Code:
<html>
<head>
<style>
.Caption {font-family: Arial;
font-weight: bold;
color: #123456}
</style>
<script language=VBScript>
'Adapted to VBScript from:
' (C) 2002 [URL unfurl="true"]www.CodeLifter.com[/URL]
' [URL unfurl="true"]http://www.codelifter.com[/URL]
' Free for all users, but leave in this header.
Option Explicit
Const SlideShowSpeed = 3000
Const CrossFadeDuration = 3
Dim Picture
Dim Caption
Dim preLoad()
Picture = Array("Image001.jpg", "Image002.jpg", "Image003.jpg")
Caption = Array("This is the first caption.", _
"This is the second caption.", _
"This is the third caption.")
Dim iss
Dim jss
jss = 0
ReDim preLoad(UBound(Picture))
For iss = 0 to UBound(Picture)
Set preLoad(iss) = document.createElement("IMG")
preLoad(iss).src = Picture(iss)
Next
Sub window_onload()
PictureBox.style.filter = "blendTrans(duration=2)"
PictureBox.style.filter = "blendTrans(duration=CrossFadeDuration)"
PictureBox.filters.blendTrans.Apply
PictureBox.src = preLoad(jss).src
CaptionBox.innerText = Caption(jss)
PictureBox.filters.blendTrans.Play
jss = jss + 1
If jss > UBound(Picture) Then jss = 0
setTimeout "window_onload", SlideShowSpeed, "VBScript"
End Sub
</script>
</head>
<body bgcolor=#000000>
<table border=0 cellpadding=0 cellspacing=0>
<tr>
<td width=350 height=280>
<img src=Image001.jpg id=PictureBox width=350 height=280>
</td>
</tr>
<tr>
<td id=CaptionBox class=Caption align=center bgcolor=#fedcba>
This is the default caption.
</td>
</tr>
</table>
</body>
</html>
Is this close to what you were after?
See CodeLifter.com for a JavaScript version with comments left in to tell what is going on here.