Hi all,
I am trying to make a slideshow that is populated by a database using ASP
and Javascript. I want to use some sort of array for varImages so that the
name of the images will be populated by varImages:
<% while not oRs.EOF %>
Pic[0] = '<%= varImages%>'
Pic[1] = '<%= varImages%>'
Pic[2] = '<%= varImages%>'
Pic[3] = '<%= varImages%>'
Pic[4] = '<%= varImages%>'
<%
oRs.MoveNext
wend
%>
Here is what I have so far:
----------------------------------------------------------------------
<%
'Declare all local variables
dim conn
dim strconn
dim strSQL
dim oRs
dim varImages
strSQL = ""
strconn = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath
("database/slideshow.mdb")
strSQL = "SELECT * FROM images ORDER BY ID"
'Set connection object
set conn = server.createobject("adodb.connection")
conn.open strconn
'Use the execute method of the connection object the insert the record
SET oRs = conn.execute(strSQL)
varImages = oRs.Fields("imageName")
%>
<script>
Set slideShowSpeed (milliseconds)
var slideShowSpeed = 5000
var crossFadeDuration = 3
var Pic = new Array()
<% while not oRs.EOF %>
Pic[0] = '<%= varImages%>'
Pic[1] = '<%= varImages%>'
Pic[2] = '<%= varImages%>'
Pic[3] = '<%= varImages%>'
Pic[4] = '<%= varImages%>'
<%
oRs.MoveNext
wend
%>
var t
var j = 0
var p = Pic.length
var preLoad = new Array()
for (i = 0; i < p; i++){
preLoad[i] = new Image()
preLoad[i].src = Pic[i]
}
function runSlideShow(){
if (document.all){
document.images.SlideShow.style.filter="blendTrans(duration=2)"
document.images.SlideShow.style.filter="blendTrans
(duration=crossFadeDuration)"
document.images.SlideShow.filters.blendTrans.Apply()
}
document.images.SlideShow.src = preLoad[j].src
if (document.all){
document.images.SlideShow.filters.blendTrans.Play()
}
j = j + 1
if (j > (p-1)) j=0
t = setTimeout('runSlideShow()', slideShowSpeed)
}
</script>
*body tag calls onload*
here is what is in the body:
<img src="<%= varImages%>" name='SlideShow' width="300" height="225"
border="0" alt="">
-------------------------------------------------------------------
Am I on the right track ?????
thanks ahead of time
Skye