Automatically change Page after 10 Seconds (ASP Classic)

A.Middleton

New Member
I have an Active Server Page, which displays Booking of the current Day. I setted the PageSize to two, so my display is displaying just 2 bookings per side, if there are more Records.So actually i have 8 bookings in my Recordset, so my ASP creates 4 Pages. To illustrate it, i have done a snapshot. DisplayAs you can see, there are 4 Pages and i can switch between them. With > i get the next two bookings and with < i can get the previous two bookings.What i need desperately is a automatically Change of the pages in 10 second intervall.For Example: Display the first page for 10 seconds, then switch to the next page and display it for 10 seconds and so on. If the last Page has been reached, then start again from the first page.I think i need something like a Timer which changes the Page every 10 seconds and a loop which starts from the first page again if the last has been reached. But i don't know how to do that.I would be glad if someone could help me.Part of my Code so far:Option Explicit'declare variablesDim Currpage, pageLen, lastNumber, PageRem, PageTenDim connection, recordset, sSQL, sConnString, next10, prev10, PDim RSPrevPage, RSNextPage, startDim thema, rsRaum, displayanzeige, bstatus, raum_id, GebaeudeBezeichnung, HinweisText, KOPPELBESTUHLUNG_ID, raumname'Get the current page the user is on, if it's the first time they'visit and the variable 'PageNo' is empty, then 'CurrPage' gets set to 1'Else the current page variable 'CurrPage' is set to the page number requestedIf IsEmpty(Request.Querystring("PageNo")) thenCurrPage = 1ElseCurrPage = Cint(Request.Querystring("PageNo"))End If'the two functions below return the next 10 and prev 10 page numberFunction getNext10(num)pageLen = len(num)If pageLen = 1 Thennext10 = 10ElseIf pageLen>1 ThenpageRem = 10pageTen = right(num, 1)next10 = num + pageRem - pageTenEnd IfgetNext10 = next10End FunctionFunction getPrev10(num)pageLen = len(num)If pageLen = 1 thenprev10 = 1ElseIf pageLen>1 thenlastNumber = right(num, 1)prev10 = num - lastNumber - 10End IfIf prev10 = 0 thenprev10 = 1End IfgetPrev10 = prev10End Function Do Until Recordset.AbsolutePage <> CurrPage OR Recordset.Eof Recordset.MoveNext Loop'the next 2 lines setup the page number for the "previous" and "next" linksRSNextPage = CurrPage + 1RSPrevPage = CurrPage -1'find out the number of pages returned in the recordset'if the Next10 page number is greater than the recordset page count'then set Next10 to the recordset pagecountIf Next10 > Recordset.PageCount ThenNext10 = Recordset.PageCountEnd If'the variable start determines where to start the page number navigation' i.e. 1, 10, 20, 30 and so on. If prev10 = 1 AND next10 - 1 < 10 Thenstart = 1Elsestart = Next10 - 10If right(start, 1) > 0 Thenstart = replace(start, right(start, 1), "0")start = start + 10End IfEnd If'This checks to make sure that there is more than one page of resultsIf Recordset.PageCount > 1 Then'Work out whether to show the Previous 10 '<<' If currpage > 1 Thenresponse.write("<a href=""paging.asp?PageNo=" & Prev10 & """><<</a> ")End If'Work out whether to show the Previous link '<' If NOT RSPrevPage = 0 thenresponse.write("<a href=""paging.asp?PageNo=" & RSPrevPage & """><</a> ")End If'Loop through the page number navigation using P as our loopcounter variable For P = start to Next10If NOT P = CurrPage thenresponse.write("<a href=""paging.asp?PageNo=" & P & """>" & P & "</a> ")Else'Don't hyperlink the current page number response.write(" <b>" & P & " </b>")End IfNext'this does the same as the "previous" link, but for the "next" linkIf NOT RSNextPage > Recordset.PageCount Thenresponse.write("<a href=""paging.asp?PageNo=" & RSNextPage & """>></a> ")End If'Work out whether to show the Next 10 '>>' If NOT Next10 = Recordset.PageCount Thenresponse.write(" <a href=""paging.asp?PageNo=" & Next10 & """>>></a>")End If
 
Back
Top