PDA

View Full Version : Resolved Ultimate Fade-in slideshow (v2.4) asp database problem



bokinhvan888
07-22-2012, 12:39 PM
1) Script Title: Ultimate Fade-in slideshow (v2.4)

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex14/fadeinslideshow.htm

3) Describe problem: I've install the script to load records from asp sql database but it's still working on FF not working on IE




<script type="text/javascript" src="/images/jquery.min.js"></script>
<script type="text/javascript" src="/images/fadeslideshow.js"></script>

<script type="text/javascript">

var mygallery=new fadeSlideShow({
wrapperid: "fadeshow1", //ID of blank DIV on page to house Slideshow
dimensions: [700, 302], //width/height of gallery in pixels. Should reflect dimensions of largest image
imagearray: [
<%
Set RS= Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT * FROM tbl_linkadv WHERE l_active=1 and l_position=5 ORDER BY l_order ASC"
RS.Open strSQL,ketnoi,3,1
If not RS.EOF and not RS.BOF then
Do While not RS.EOF
i=1
if i<rs.recordcount then
%>
["<%=rs("l_image")%>", "", "", "<%=rs("l_name")%>"],
<%else%>
["<%=rs("l_image")%>", "", "", "<%=rs("l_name")%>"]
<%
end if
i=i+1
RS.MoveNext
Loop
End if
RS.Close
call closeDatabase()
%>

],
displaymode: {type:'auto', pause:5000, cycles:0, wraparound:false},
persist: false, //remember last viewed slide and recall within same session?
fadeduration: 1000, //transition duration (milliseconds)
descreveal: "peekaboo",
togglerid: ""
})
</script>

<div id="fadeshow1"></div>


Please help me to resolve this problem.Thanks so much!

jscheuer1
07-22-2012, 02:49 PM
That indicates to me that even though you have:



if i<rs.recordcount then
%>
["<%=rs("l_image")%>", "", "", "<%=rs("l_name")%>"],
<%else%>
["<%=rs("l_image")%>", "", "", "<%=rs("l_name")%>"]
<%
end if

A comma is being placed after the last imagearray element. I think you need a nested if then in there. Something like:


if i<rs.recordcount then
if i<rs.recordcount - 1 then
%>
["<%=rs("l_image")%>", "", "", "<%=rs("l_name")%>"],
<%else%>
["<%=rs("l_image")%>", "", "", "<%=rs("l_name")%>"]
<%
end if
end if

In any case, look at the served source code of the page -

While the page is in the browser, use the browser's 'View Source'. Look at the array. There should be no comma after the last imagearray element. If there is one there, IE will throw an error. You will have to adjust your asp code until that comma is removed. Other browsers error correct for this, but technically no comma is allowed after the last item in a javascript array or the last property in a javascript object.

If you want more help, please include a link to the page on your site that contains the problematic code so we can check it out.

bokinhvan888
07-22-2012, 03:28 PM
Thanks jscheuer1. I have fixed the code as your comment but it's still having comma for the last item. How to remove it?

bokinhvan888
07-22-2012, 03:56 PM
ok.i fixed it.the code shoule be :-)


i=1
Do While not RS.EOF


Please close the topic.
Thanks jscheuer1!