So how come your original posted code doesn't work???
Let's look at it again. With minor corrections/adaptations.
Code:
<script type="text/javascript">
function banner( image, number, url )
{
... this is the constructor for a banner ...
}
var pic = new Array( );
<%
Set conn = server.createobject("adodb.connection")
conn.open "DSN=XXXX" ' If possible, AVOID using DSN's for connections!!!
sql="Select bannerImage, bannerNumber, bannerURL from table"
Set rs = conn.Execute( sql )
counter = 0;
Do Until rs.EOF
image = rs("bannerImage")
num = rs("bannerNumber")
url = rs("bannerURL")
%>
pic[<%=counter%>] = new banner("<%=image%>","<%=num%>","<%=url%>");
<%
counter = counter + 1
rs.MoveNext
Loop
rs.close
%>
Now, there *IS* a slightly more elegant way to do this, which is also a little faster, but it's harder to follow.
Code:
<script type="text/javascript">
function banner( image, number, url )
{
... this is the constructor for a banner ...
}
<%
Set conn = server.createobject("adodb.connection")
conn.open "DSN=XXXX" ' If possible, AVOID using DSN's for connections!!!
sql="Select bannerImage, bannerNumber, bannerURL from table"
Set rs = conn.Execute( sql )
prefix = "new banner("""
midfix = ""","""
suffix1 = """)"
suffix2 = "," & vbNewLine
jsData = rs.getString( , , midfix, suffix1 & suffix2 & prefix )
jsData = prefix & Left( jsData, Len(jsData) - Len(suffix2) - Len(prefix) )
rs.Close
%>
var pic = new Array(
<%=jsData%>
);
Here's an old FAQ I wrote that explains the above.