codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  next and previous buttons  crmpicco at 10:13 on Thursday, March 17, 2005
 

I have this code below in a page called '/forum/bookdates_opt.html'.

<%
set rscount=con.execute("select count(*) from trip_master where agencyid = '"&agencyid&"' and regular_trip = 'Option'")
count_rows = rscount("count(*)") ' number of rows in the db that is option
count_rows_div = count_rows/50
pages = round(count_rows_div)
Dim intRecordsPerPage
intRecordsPerPage = 50 ' how many records (bookings) are shown on each page

Dim queryPageOn
queryPageOn = count_rows

If NOT isNumeric(queryPageOn) then
queryPageOn = "1"
End If
queryPageOn = CINT(queryPageOn)
Response.Write(sProjectPrev & "  ")

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'# Create Page Numbers & Links
' Creates 'Page' and '1', '2', '3' and so on,.....
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

response.Write "<table border=0 align=center bordercolor=#000000 width=200>"
response.Write "<tr><td align=center>"
Dim iPages, iPagesTemp

response.write "<font face=verdana size=2>Page  </font>"
For iPages=1 to pages
iPagesTemp = iPages-1

If NOT queryPageOn=iPages then
Response.write "<a href='?vara=" & iPagesTemp*intRecordsPerPage & "&timeoption="&timeoption&"&searchby="&user&"&agencyid="&agencyid&"' ><font face=verdana size=2><b>" & iPages & "<b></font></a>   "
Else
Response.write "<span class='greyt'>[</span><a href='?vara=" & iPagesTemp*intRecordsPerPage & "&page="& iPages & "'>" & iPages & "</a><span class='greyt'>]</span>"
End If
Next
Response.Write(""&sProjectNext)
response.write "</td></tr>"

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Creates 'Previous' and 'Next' buttons to skip forwards and back from page to page '
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

sStartQuery = vara
response.write "<tr><td align=center>"

If sStartQuery = "" or sStartQuery = "0" then 'The 'PREVIOUS' link is DISABLED
sProjectPrev = "<a span class='sgrey'>Previous</span>"
response.write "<a span class='sgrey'>Previous</span>"
ElseIf sStartQuery > 0 then ' The 'PREVIOUS' link is ENABLED
sProjectPrev = "<a class='elinks' href='?start=" & sStartQuery - intRecordsPerPage & "'>Previous</span>"
response.write "<a class='elinks' href=# onclick='javascript: history.back()' title='Previous 50 Bookings'>Previous</span></a>"
End If


eEndQuery = sStartQuery+intRecordsPerPage
response.write "  "
sMaxStart = (intPages*intRecordsPerPage)-intRecordsPerPage
If eEndQuery > count_rows then ' The 'NEXT' link is DISABLED
sProjectNext = "<a span class='sgrey'>Next</span>"
response.write "<a span class='sgrey'>Next</span>"
ElseIf eEndQuery < count_rows then ' The 'NEXT' link is ENABLED
sProjectNext= "<a class='elinks' href='?vara=" & iPagesTemp*intRecordsPerPage & "'>Next</span>"
response.write "<a class='elinks' href='?vara=" & sStartQuery + intRecordsPerPage & "&timeoption="&timeoption&"&agencyid="&agencyid&"&searchby="&user&"' title='Next 50 Bookings'>Next</span>"
End If
response.write "</td></tr>"
response.write "</table>"

%>

It gives me a Page 1-2-3-4 etc.... at the foot of the page and it also give me a 'Next' and 'Previous' button, which all work fine.

What i am looking for is that when it says 'Page 1-2-3-4' etc.... then it UNDERLINES or HIGHLIGHTS the page that you are on.

For example, if you click '2' or click 'Next' to go to page two then '2' is underlined or has a [2] around it.

Similar to Google:

http://www.google.co.uk/search?q=st.+patrick's+day

Any ideas guys?

Thanks in advance.

Picco








CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums








Recent Forum Threads
•  Use of VB .NET
•  Cookies and new pages
•  need help with e-mail validation
•  Problems with DHTML dropdown menus
•  Re: Passing values from a select box to a text box
•  lowerCase to UpperCase
•  Re: Javascript validation that will stop a ` (apostrophe) being entered
•  Re: pop-up Javascript calendar
•  nested classes


Recent Articles
Communicating with the Database (Using ADO)
MagicGrid
Simple Thumbnail Browsing Solution
Type Anywhere
A Better Moustrap: FmtDate to replace FormatDateTime
ASP.NET Forum Source Code
Internal Search Engine
Javascript Growing Window
Simple date validation
Search engine friendly URLs using ASP.NET (C#.NET)


Site Survey
Help us serve you better. Take a five minute survey. Click here!

© Copyright codetoad.com 2001-2005