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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Increment URL Parameter

Status
Not open for further replies.

willhaney

Programmer
Jun 21, 2006
6
0
0
US
If a page such as is displayed and the following JavaScript is placed in the url the next thread shows:

1319898 --> 1319899

Question: how can I make the JavaScript a shortcut in my links so that I may increment through the threads with a click?

JavaScript to increment url:
javascript:var u=document.location.href;var p=u.lastIndexOf("=");if(p!=-1){var n=u.substr(p+1);n++;document.location.href=u.substr(0,p+1)+n;}
 
If you are using IE, create a bookmark to any page. Name it "Next Thread" or something. Then right-click on the bookmark and go to "Properties". Change the url to the javascript above. You'll get a security warning - click ok.

Adam
 
When the script is placed into the Address of the browser (ie) it works fine, incrementing the last parameter of the URL and returning the next page.

When the script is saved to a file then referenced with a shortcut an error is returned:

a1132561-240-js.JPG
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top