Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with Frames 1

Status
Not open for further replies.

Guest_imported

New member
Joined
Jan 1, 1970
Messages
0
Hello,
I hope that this will be simple for someone. Is is possible to nest framesets in a way so that there is one large frameset encompassing another frameset? That way when the user scrolls, the whole page moves and not an individual frame.

I have an illustration below which explains what I'm talking about.


------------------------------------------------------------


Framset one 100% width, 100% height
Scrolls and drags Frameset two along with it.
---------------------------------------------

Frameset two contains all the HTML.

This Framset contains no scrollbars.



---------------------------------------------



------------------------------------------------------------
 
I have an asp page in which images are being displayed from a recordset. It has click for next image. The image loads on the same page. The problem is that the whole page reloads and I just want the next image to load. I thought that I could use a frame to put the page with the recordset and the pictures so that just the picture will load. I need the whole page to scroll as one though so that's how I came up with the frame idea. Any suggestions?
 
Hi

If you just want your image to load, and not the page, all you need to do is call a swap image command with the new image path. This will load the new image into the page only. All you then need to do is create your list of images in a javascript array, and when people scroll left and right it increaments/decrements the index of the array, and so loads that picture.

I've done it, and it works. Derren
[The only person in the world to like Word]
 
I would prefer to do a swap image command but I couldn't get it to work. The way it is right now, <A HREF=&quot;<%=MM_moveNext%>&quot;>Next </A> calls the next image in my recordset which calls about 200 lines of asp code.
I thought about creating a recordset so that the next image could be another field like <img src=&quot;<%=(Recordset2.Fields.Item(&quot;Image_1&quot;).Value)%>&quot;> The one after that could be <img src=&quot;<%=(Recordset2.Fields.Item(&quot;Image_2&quot;).Value)%>&quot;>. The problem is that there isn't a set number of images per Id. So if one has 10 images and the next has only two, I don't know how to put them all into the array.
Any suggestions? I'm all out.

Thanks,
A.D.
 
Write Javascript with ASP ( I have left out the &quot;script&quot; tags ans the like for clarity):

Code:
<%=(&quot;imgarray = new Array(&quot; & RS.recordcount & &quot;)&quot; & vbnewline)%>
<% While NOT rs.EOF %>
<%=&quot;imgarray[i] = &quot; & path_of_your_image & &quot;;&quot; & vbnewline%>
<% rs.Movenext()
Wend %>

Now you have written a load of javascript which will fill the client side array with every one of your images (textually). Then add this JS code:

Code:
picno=1 ;
nLastElement = <%=rs.recordcount%>
nLastElement -- 

function swiveleml() {	
	picno--;
	if(picno==-1) {picno=nLastElement}
	document['yourimage'].src = imgarray[picno];
}

function swivelemr() {
	picno++;
	if(picno==nElements) {picno=0}
	document['yourimage'].src = imgarray[picno];
}

Then on the two forward and back buttons put add this code in their &quot;A&quot; tags:

Code:
onClick=&quot;swivelemr()&quot;

or

onClick=&quot;swiveleml()&quot;

(One goes backwards through the array, the other forwards) Derren
[The only person in the world to like Word]
 
I'm including my code and I hope that you don't mind looking at it (it's a lot), probably some of it is unnecessary. I wrote this page with Ultradev using vbscript. Will your code work with that? Also I'm sure that your code would replace some of what I have, just not exactly sure what. I really appreciate this.

<%@LANGUAGE=&quot;VBSCRIPT&quot;%>
<!--#include file=&quot;Connections/AustinLuxuryApartments.asp&quot; -->
<%
Dim Recordset3__varApartment_ID
Recordset3__varApartment_ID = &quot;%&quot;
if (Request.QueryString(&quot;Apartment_ID&quot;) <> &quot;&quot;) then Recordset3__varApartment_ID = Request.QueryString(&quot;Apartment_ID&quot;)
%>
<%
set Recordset3 = Server.CreateObject(&quot;ADODB.Recordset&quot;)
Recordset3.ActiveConnection = MM_AustinLuxuryApartments_STRING
Recordset3.Source = &quot;SELECT Pictures FROM Images WHERE Apartment_ID Like '&quot; + Replace(Recordset3__varApartment_ID, &quot;'&quot;, &quot;''&quot;) + &quot;'&quot;
Recordset3.CursorType = 0
Recordset3.CursorLocation = 2
Recordset3.LockType = 3
Recordset3.Open()
Recordset3_numRows = 0
%>
<%
' *** Recordset Stats, Move To Record, and Go To Record: declare stats variables

' set the record count
Recordset3_total = Recordset3.RecordCount

' set the number of rows displayed on this page
If (Recordset3_numRows < 0) Then
Recordset3_numRows = Recordset3_total
Elseif (Recordset3_numRows = 0) Then
Recordset3_numRows = 1
End If

' set the first and last displayed record
Recordset3_first = 1
Recordset3_last = Recordset3_first + Recordset3_numRows - 1

' if we have the correct record count, check the other stats
If (Recordset3_total <> -1) Then
If (Recordset3_first > Recordset3_total) Then Recordset3_first = Recordset3_total
If (Recordset3_last > Recordset3_total) Then Recordset3_last = Recordset3_total
If (Recordset3_numRows > Recordset3_total) Then Recordset3_numRows = Recordset3_total
End If
%>
<%
' *** Recordset Stats: if we don't know the record count, manually count them

If (Recordset3_total = -1) Then

' count the total records by iterating through the recordset
Recordset3_total=0
While (Not Recordset3.EOF)
Recordset3_total = Recordset3_total + 1
Recordset3.MoveNext
Wend

' reset the cursor to the beginning
If (Recordset3.CursorType > 0) Then
Recordset3.MoveFirst
Else
Recordset3.Requery
End If

' set the number of rows displayed on this page
If (Recordset3_numRows < 0 Or Recordset3_numRows > Recordset3_total) Then
Recordset3_numRows = Recordset3_total
End If

' set the first and last displayed record
Recordset3_first = 1
Recordset3_last = Recordset3_first + Recordset3_numRows - 1
If (Recordset3_first > Recordset3_total) Then Recordset3_first = Recordset3_total
If (Recordset3_last > Recordset3_total) Then Recordset3_last = Recordset3_total

End If
%>
<%
' *** Move To Record and Go To Record: declare variables

Set MM_rs = Recordset3
MM_rsCount = Recordset3_total
MM_size = Recordset3_numRows
MM_uniqueCol = &quot;&quot;
MM_paramName = &quot;&quot;
MM_offset = 0
MM_atTotal = false
MM_paramIsDefined = false
If (MM_paramName <> &quot;&quot;) Then
MM_paramIsDefined = (Request.QueryString(MM_paramName) <> &quot;&quot;)
End If
%>
<%
' *** Move To Record: handle 'index' or 'offset' parameter

if (Not MM_paramIsDefined And MM_rsCount <> 0) then

' use index parameter if defined, otherwise use offset parameter
r = Request.QueryString(&quot;index&quot;)
If r = &quot;&quot; Then r = Request.QueryString(&quot;offset&quot;)
If r <> &quot;&quot; Then MM_offset = Int(r)

' if we have a record count, check if we are past the end of the recordset
If (MM_rsCount <> -1) Then
If (MM_offset >= MM_rsCount Or MM_offset = -1) Then ' past end or move last
If ((MM_rsCount Mod MM_size) > 0) Then ' last page not a full repeat region
MM_offset = MM_rsCount - (MM_rsCount Mod MM_size)
Else
MM_offset = MM_rsCount - MM_size
End If
End If
End If

' move the cursor to the selected record
i = 0
While ((Not MM_rs.EOF) And (i < MM_offset Or MM_offset = -1))
MM_rs.MoveNext
i = i + 1
Wend
If (MM_rs.EOF) Then MM_offset = i ' set MM_offset to the last possible record

End If
%>
<%
' *** Move To Record: if we dont know the record count, check the display range

If (MM_rsCount = -1) Then

' walk to the end of the display range for this page
i = MM_offset
While (Not MM_rs.EOF And (MM_size < 0 Or i < MM_offset + MM_size))
MM_rs.MoveNext
i = i + 1
Wend

' if we walked off the end of the recordset, set MM_rsCount and MM_size
If (MM_rs.EOF) Then
MM_rsCount = i
If (MM_size < 0 Or MM_size > MM_rsCount) Then MM_size = MM_rsCount
End If

' if we walked off the end, set the offset based on page size
If (MM_rs.EOF And Not MM_paramIsDefined) Then
If (MM_offset > MM_rsCount - MM_size Or MM_offset = -1) Then
If ((MM_rsCount Mod MM_size) > 0) Then
MM_offset = MM_rsCount - (MM_rsCount Mod MM_size)
Else
MM_offset = MM_rsCount - MM_size
End If
End If
End If

' reset the cursor to the beginning
If (MM_rs.CursorType > 0) Then
MM_rs.MoveFirst
Else
MM_rs.Requery
End If

' move the cursor to the selected record
i = 0
While (Not MM_rs.EOF And i < MM_offset)
MM_rs.MoveNext
i = i + 1
Wend
End If
%>
<%
' *** Move To Record: update recordset stats

' set the first and last displayed record
Recordset3_first = MM_offset + 1
Recordset3_last = MM_offset + MM_size
If (MM_rsCount <> -1) Then
If (Recordset3_first > MM_rsCount) Then Recordset3_first = MM_rsCount
If (Recordset3_last > MM_rsCount) Then Recordset3_last = MM_rsCount
End If

' set the boolean used by hide region to check if we are on the last record
MM_atTotal = (MM_rsCount <> -1 And MM_offset + MM_size >= MM_rsCount)
%>
<%
' *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters

' create the list of parameters which should not be maintained
MM_removeList = &quot;&index=&quot;
If (MM_paramName <> &quot;&quot;) Then MM_removeList = MM_removeList & &quot;&&quot; & MM_paramName & &quot;=&quot;
MM_keepURL=&quot;&quot;:MM_keepForm=&quot;&quot;:MM_keepBoth=&quot;&quot;:MM_keepNone=&quot;&quot;

' add the URL parameters to the MM_keepURL string
For Each Item In Request.QueryString
NextItem = &quot;&&quot; & Item & &quot;=&quot;
If (InStr(1,MM_removeList,NextItem,1) = 0) Then
MM_keepURL = MM_keepURL & NextItem & Server.URLencode(Request.QueryString(Item))
End If
Next

' add the Form variables to the MM_keepForm string
For Each Item In Request.Form
NextItem = &quot;&&quot; & Item & &quot;=&quot;
If (InStr(1,MM_removeList,NextItem,1) = 0) Then
MM_keepForm = MM_keepForm & NextItem & Server.URLencode(Request.Form(Item))
End If
Next

' create the Form + URL string and remove the intial '&' from each of the strings
MM_keepBoth = MM_keepURL & MM_keepForm
if (MM_keepBoth <> &quot;&quot;) Then MM_keepBoth = Right(MM_keepBoth, Len(MM_keepBoth) - 1)
if (MM_keepURL <> &quot;&quot;) Then MM_keepURL = Right(MM_keepURL, Len(MM_keepURL) - 1)
if (MM_keepForm <> &quot;&quot;) Then MM_keepForm = Right(MM_keepForm, Len(MM_keepForm) - 1)

' a utility function used for adding additional parameters to these strings
Function MM_joinChar(firstItem)
If (firstItem <> &quot;&quot;) Then
MM_joinChar = &quot;&&quot;
Else
MM_joinChar = &quot;&quot;
End If
End Function
%>
<%
' *** Move To Record: set the strings for the first, last, next, and previous links

MM_keepMove = MM_keepBoth
MM_moveParam = &quot;index&quot;

' if the page has a repeated region, remove 'offset' from the maintained parameters
If (MM_size > 0) Then
MM_moveParam = &quot;offset&quot;
If (MM_keepMove <> &quot;&quot;) Then
params = Split(MM_keepMove, &quot;&&quot;)
MM_keepMove = &quot;&quot;
For i = 0 To UBound(params)
nextItem = Left(params(i), InStr(params(i),&quot;=&quot;) - 1)
If (StrComp(nextItem,MM_moveParam,1) <> 0) Then
MM_keepMove = MM_keepMove & &quot;&&quot; & params(i)
End If
Next
If (MM_keepMove <> &quot;&quot;) Then
MM_keepMove = Right(MM_keepMove, Len(MM_keepMove) - 1)
End If
End If
End If

' set the strings for the move to links
If (MM_keepMove <> &quot;&quot;) Then MM_keepMove = MM_keepMove & &quot;&&quot;
urlStr = Request.ServerVariables(&quot;URL&quot;) & &quot;?&quot; & MM_keepMove & MM_moveParam & &quot;=&quot;
MM_moveFirst = urlStr & &quot;0&quot;
MM_moveLast = urlStr & &quot;-1&quot;
MM_moveNext = urlStr & Cstr(MM_offset + MM_size)
prev = MM_offset - MM_size
If (prev < 0) Then prev = 0
MM_movePrev = urlStr & Cstr(prev)
%>
<table width=&quot;46%&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; height=&quot;200&quot;>
<tr>
<td height=&quot;152&quot;><img src=&quot;<%=(Recordset3.Fields.Item(&quot;Pictures&quot;).Value)%>&quot;></td>
</tr>
<tr>
<td> <A HREF=&quot;<%=MM_moveNext%>&quot;>
Next </A><%=(Recordset3_first)%>Of <%=(Recordset3_total)%></td>
</tr>
</table>


<%
Recordset3.Close()
%>



 
Try this - it's difficult to check properly without the database and connections, but I think it'll work

Code:
<%@LANGUAGE=&quot;VBSCRIPT&quot;%> 
<!--#include file=&quot;Connections/AustinLuxuryApartments.asp&quot; -->
<%
Dim Recordset3__varApartment_ID
Recordset3__varApartment_ID = &quot;%&quot;
if (Request.QueryString(&quot;Apartment_ID&quot;)   <> &quot;&quot;) then Recordset3__varApartment_ID = Request.QueryString(&quot;Apartment_ID&quot;)  
%>
<%
set Recordset3 = Server.CreateObject(&quot;ADODB.Recordset&quot;)
Recordset3.ActiveConnection = MM_AustinLuxuryApartments_STRING
Recordset3.Source = &quot;SELECT Pictures  FROM Images  WHERE Apartment_ID Like '&quot; + Replace(Recordset3__varApartment_ID, &quot;'&quot;, &quot;''&quot;) + &quot;'&quot;
Recordset3.CursorType = 3
Recordset3.CursorLocation = 2
Recordset3.LockType = 3
Recordset3.Open()
Recordset3_numRows = 0
%>
<%
imagecount = Recordset3.recordcount
%>
<html>
<head>
<title></title>
<%=response.write(&quot;<script language=&quot;&quot;JavaScript&quot;&quot;>&quot; & vbnewline & &quot;<!--&quot; & vbnewline)%>
picno=1 ;
nLastElement = <%=imagecount%>;
nLastElement -- ;
imgarray = new Array(<%=imagecount%>)

<% While NOT recordset3.EOF %>
<%=&quot;imgarray[i] = &quot;&quot;&quot; & recordset3(&quot;pictures&quot;) & &quot;&quot;&quot;;&quot; & vbnewline%>
<% recordset3.Movenext()
Wend %>
function swiveleml() {    
    picno--;
    if(picno==-1) {picno=nLastElement}
    document['yourimage'].src = imgarray[picno];
}

function swivelemr() {
    picno++;
    if(picno==nElements) {picno=0}
    document['yourimage'].src = imgarray[picno];
}
//-->
</script>
</head>
<body bgcolor=&quot;#FFFFFF&quot;>
<table width=&quot;46%&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; height=&quot;200&quot;>
  <tr> 
    <td height=&quot;152&quot;><img src=&quot;<%=(Recordset3.Fields.Item(&quot;Pictures&quot;).Value)%>&quot; name=&quot;yourimage&quot;></td>
  </tr>
  <tr> 
    <td><A HREF=&quot;#&quot; onClick=&quot;swiveleml()&quot;> Previous </A> <A HREF=&quot;#&quot; onClick=&quot;swivelemr()&quot;> Next </A></td>
  </tr>
</table>
</body></html>

<%
Recordset3.Close()
%>
Derren
[The only person in the world to like Word]
 
Hi,
I really appreciate you helping me with this. I tried the code and I got this error :ADODB.Field error '800a0bcd'

Either BOF or EOF is True, or the current record has been deleted; the operation requested by the application requires a current record.

/AustinLuxuryApartments/include.asp, line 51

Also I ran debug in browser and I got this if this means anything to you:

picno=1 ; nLastElement = -1; nLastElement -- ; imgarray = new Array(-1) imgarray = &quot;Pictures/20a.JPG&quot;; imgarray = &quot;Pictures/20b.JPG&quot;; imgarray = &quot;Pictures/20c.JPG&quot;; imgarray = &quot;Pictures/20d.JPG&quot;; imgarray = &quot;Pictures/20e.JPG&quot;; imgarray = &quot;Pictures/20f.JPG&quot;; imgarray = &quot;Pictures/1.JPG&quot;; function swiveleml() { picno--; if(picno==-1) {picno=nLastElement} document['yourimage'].src = imgarray[picno]; } function swivelemr() { picno++; if(picno==nElements) {picno=0} document['yourimage'].src = imgarray[picno]; } //-->
ADODB.Field error '800a0bcd'

Either BOF or EOF is True, or the current record has been deleted; the operation requested by the application requires a current record.

/AustinLuxuryApartments/TMPe7wansze36.asp, line 118



If you could look at this I would really appreciate it. I would never figure it out on my own.

Thanks a lot

A.Davis


 
Sorry! forgot to add this extra line after the While ... Wend loop:

Code:
<% recordset3.Movenext()
Wend
recordset3.movefirst()
%>

Basically, we have looped through the recordset and left it at the end of the file. So we are just putting it back to the start.
Derren
[The only person in the world to like Word]
 
I just noticed that you are returning -1 as your recordcount. You have to make sure that the &quot;Recordset3.CursorType = 3&quot; otherwise the javascript won't work!

Derren
[The only person in the world to like Word]
 
Sorry to keep bugging you but your help is really appreciated.

The page loads and shows the first picture but when I hit Previous, the picture shows blank and when I hit next nothing happens. Here is all the code in the page.

<%@LANGUAGE=&quot;VBSCRIPT&quot;%>
<!--#include file=&quot;Connections/AustinLuxuryApartments.asp&quot; -->
<%
Dim Recordset3__varApartment_ID
Recordset3__varApartment_ID = &quot;%&quot;
if (Request.QueryString(&quot;Apartment_ID&quot;) <> &quot;&quot;) then Recordset3__varApartment_ID = Request.QueryString(&quot;Apartment_ID&quot;)
%>
<%
set Recordset3 = Server.CreateObject(&quot;ADODB.Recordset&quot;)
Recordset3.ActiveConnection = MM_AustinLuxuryApartments_STRING
Recordset3.Source = &quot;SELECT Pictures FROM Images WHERE Apartment_ID Like '&quot; + Replace(Recordset3__varApartment_ID, &quot;'&quot;, &quot;''&quot;) + &quot;'&quot;
Recordset3.CursorType = 3
Recordset3.CursorLocation = 2
Recordset3.LockType = 3
Recordset3.Open()
Recordset3_numRows = 0
%>
<%
imagecount = Recordset3.recordcount
%>
<html>
<head>
<title></title>
<%=response.write(&quot;<script language=&quot;&quot;JavaScript&quot;&quot;>&quot; & vbnewline & &quot;<!--&quot; & vbnewline)%>
picno=1 ;
nLastElement = <%=imagecount%>;
nLastElement -- ;
imgarray = new Array(<%=imagecount%>)

<% While NOT recordset3.EOF %>
<%=&quot;imgarray = &quot;&quot;&quot; & recordset3(&quot;pictures&quot;) & &quot;&quot;&quot;;&quot; & vbnewline%>
<% recordset3.Movenext()
Wend
recordset3.movefirst()
%>
function swiveleml() {
picno--;
if(picno==-1) {picno=nLastElement}
document['yourimage'].src = imgarray[picno];
}

function swivelemr() {
picno++;
if(picno==nElements) {picno=0}
document['yourimage'].src = imgarray[picno];
}
//-->
</script>
</head>
<body bgcolor=&quot;#FFFFFF&quot;>
<table width=&quot;46%&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; height=&quot;200&quot;>
<tr>
<td height=&quot;152&quot;><img src=&quot;<%=(Recordset3.Fields.Item(&quot;Pictures&quot;).Value)%>&quot; name=&quot;yourimage&quot;></td>
</tr>
<tr>
<td><A HREF=&quot;#&quot; onClick=&quot;swiveleml()&quot;> Previous </A> <A HREF=&quot;#&quot; onClick=&quot;swivelemr()&quot;> Next </A></td>
</tr>
</table>
</body></html>

<%
Recordset3.Close()
%>

Here is the code for the page that is displayed:

<html>
<head>
<title></title>
<script language=&quot;JavaScript&quot;>
<!--

picno=1 ;
nLastElement = 7;
nLastElement -- ;
imgarray = new Array(7)

imgarray = &quot;Pictures/20a.JPG&quot;;
imgarray = &quot;Pictures/20b.JPG&quot;;
imgarray = &quot;Pictures/20c.JPG&quot;;
imgarray = &quot;Pictures/20d.JPG&quot;;
imgarray = &quot;Pictures/20e.JPG&quot;;
imgarray = &quot;Pictures/20f.JPG&quot;;
imgarray = &quot;Pictures/1.JPG&quot;;

function swiveleml() {
picno--;
if(picno==-1) {picno=nLastElement}
document['yourimage'].src = imgarray[picno];
}

function swivelemr() {
picno++;
if(picno==nElements) {picno=0}
document['yourimage'].src = imgarray[picno];
}
//-->
</script>
</head>
<body bgcolor=&quot;#FFFFFF&quot;>
<table width=&quot;46%&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; height=&quot;200&quot;>
<tr>
<td height=&quot;152&quot;><img src=&quot;Pictures/20a.JPG&quot; name=&quot;yourimage&quot;></td>
</tr>
<tr>
<td><A HREF=&quot;#&quot; onClick=&quot;swiveleml()&quot;> Previous </A> <A HREF=&quot;#&quot; onClick=&quot;swivelemr()&quot;> Next </A></td>
</tr>
</table>
</body></html>

Thanks a lot,

A.Davis
 
In the code where it is setting the value of the array elements I forgot to add the array index increment, and I would only have seen it thanks to the fact that you forgot to put after the array name! That was a good call to post the HTML response so that I can check the javascript:

<% While NOT recordset3.EOF %>
<%=&quot;imgarray = &quot;&quot;&quot; & recordset3(&quot;pictures&quot;) & &quot;&quot;&quot;;&quot; & vbnewline%>
<% recordset3.Movenext()
Wend
recordset3.movefirst()
%>

should be

<%
lcCount = 0
While NOT recordset3.EOF %>
<%=&quot;imgarray[&quot; & lcCount & &quot;] = &quot;&quot;&quot; & recordset3(&quot;pictures&quot;) & &quot;&quot;&quot;;&quot; & vbnewline%>
<% recordset3.Movenext()
lcCount = lcCount + 1
Wend
recordset3.movefirst()
%>

Keep going - nearly there!
Derren
[The only person in the world to like Word]
 
Hi,
The code works! and thanks a lot. I have one question though. I couldn't get next to work and I tried to reply last night but the server was down or something. Anyway I looked at

function swivelemr() {
picno++;
if(picno==nElements) {picno=0}
document['yourimage'].src = imgarray[picno];
}

and didn't see nElements defined anywhere. I changed nElements to nLastElement. Next works now but if I hit previous to the last image in the array and then hit next the image goes blank. Next returns a blank image after that until I hit previous past the last image. Also it seems that by hitting previous one more image is diplayed than by hitting next. I'm not sure if it's something that I did or if nElements is supposed to be defined. If you could look at it I would really appreciate it. I'm including the code below and thanks a lot.

<%@LANGUAGE=&quot;VBSCRIPT&quot;%>
<!--#include file=&quot;Connections/AustinLuxuryApartments.asp&quot; -->
<%
Dim Recordset3__varApartment_ID
Recordset3__varApartment_ID = &quot;%&quot;
if (Request.QueryString(&quot;Apartment_ID&quot;) <> &quot;&quot;) then Recordset3__varApartment_ID = Request.QueryString(&quot;Apartment_ID&quot;)
%>
<%
set Recordset3 = Server.CreateObject(&quot;ADODB.Recordset&quot;)
Recordset3.ActiveConnection = MM_AustinLuxuryApartments_STRING
Recordset3.Source = &quot;SELECT Pictures FROM Images WHERE Apartment_ID Like '&quot; + Replace(Recordset3__varApartment_ID, &quot;'&quot;, &quot;''&quot;) + &quot;'&quot;
Recordset3.CursorType = 3
Recordset3.CursorLocation = 2
Recordset3.LockType = 3
Recordset3.Open()
Recordset3_numRows = 0
%>
<%
imagecount = Recordset3.recordcount
%>
<html>
<head>
<title></title>
<%=response.write(&quot;<script language=&quot;&quot;JavaScript&quot;&quot;>&quot; & vbnewline & &quot;<!--&quot; & vbnewline)%>
picno=1 ;
nLastElement = <%=imagecount%>;
nLastElement -- ;
imgarray = new Array(<%=imagecount%>)

<%
lcCount = 0
While NOT recordset3.EOF %>
<%=&quot;imgarray[&quot; & lcCount & &quot;] = &quot;&quot;&quot; & recordset3(&quot;pictures&quot;) & &quot;&quot;&quot;;&quot; & vbnewline%>
<% recordset3.Movenext()
lcCount = lcCount + 1
Wend
recordset3.movefirst()
%>




function swiveleml() {
picno--;
if(picno==-1) {picno=nLastElement}
document['yourimage'].src = imgarray[picno];
}

function swivelemr() {
picno++;
if(picno==nLastElement) {picno=0}
document['yourimage'].src = imgarray[picno];
}
//-->
</script>
</head>
<body bgcolor=&quot;#FFFFFF&quot;>
<table width=&quot;46%&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; height=&quot;200&quot;>
<tr>
<td height=&quot;152&quot;><img src=&quot;<%=(Recordset3.Fields.Item(&quot;Pictures&quot;).Value)%>&quot; name=&quot;yourimage&quot;></td>
</tr>
<tr>
<td><A HREF=&quot;#&quot; onClick=&quot;swiveleml()&quot;> Previous </A> <A HREF=&quot;#&quot; onClick=&quot;swivelemr()&quot;> Next </A></td>
</tr>
</table>
</body></html>

<%
Recordset3.Close()
%>

 
Hi,

nElements is the number of pictures you have, so change it to:

Code:
function swivelemr() {
    picno++;
    if(picno==<%=imagecount%>) {picno=0}
    document['yourimage'].src = imgarray[picno];
}

This would also explain why you get more images one way than the other!
Derren
[The only person in the world to like Word]
 
No problem. Send me a link to the page if possible so I can see it, and if you think I have been helpful mark the thread so that others can use it as well. Derren
[The only person in the world to like Word]
 
The web address is austinapartmentstore.com/index.asp the search part isn't complete yet but please look around.

Thanks again,

A.Davis
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top