#1 (permalink)  
Old 07-04-2007, 03:01 PM
Registered User
 
Join Date: Jul 2004
Posts: 249
paging with JavaScript and ASP "Next" "Previous"

I have a 700 page website paged pg_0001 - pg_0700. And I figure to my knowledge in JavaScript and ASP ( unless you have an easier way ) I want to first read the existing pathname:

Code:
document.write(location.pathname);
Then somehow add +1 ( next page ) to the string or -1 ( previous page )

Code:
	function prevLocation() {
		document.write(location.pathname);
		window.location="pg_0001<%'1%>.asp";
	}
	function nextLocation() {
		document.write(location.pathname);
		window.location="pg_0001<%'1%>.asp";
	}
Code:
<a href="#" onclick="prevLocation();">Previous Page</a>
<a href="#" onclick="nextLocation();">Next Page</a>
Reply With Quote

  #2 (permalink)  
Old 07-05-2007, 10:19 AM
curtiss's Avatar
Moderator
 
Join Date: May 2003
Posts: 1,445
You will need to use a regexp to extract just the number you want out of the page location. There's a decent VBScript RegExp tester at http://www.regular-expressions.info/...ptexample.html (you have to use IE in order to use it for some reason) and there is a javascript regexp tester at http://www.regular-expressions.info/...ptexample.html

Once you extract the number from the page location, then you can easily use mathematical expressions to add and subtract 1 from that number, and re-write the links.
__________________
I hate Internet Explorer! Anyone with me?
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT -5. The time now is 01:34 PM.

 
Bitrix
Clicky Web Analytics
CloudContacts
Maxtango


Subscribe to our feed | add to myYahoo!

Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.2.0
© 1997-2007 HTMLCenter