Go Back   CodingForums.com > :: Client side development > General web building

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-06-2005, 09:57 PM   PM User | #1
Rocket Boy
New Coder

 
Join Date: Oct 2005
Location: Near some trees
Posts: 66
Thanks: 0
Thanked 0 Times in 0 Posts
Rocket Boy is an unknown quantity at this point
1 line of code required

Instead of having a link on page 1 which takes you to page 2, and a link on page 2 which takes you to page 3...

Is there a line that I can use which can be same on all of the pages. A link that says choose the next pagename.html in sequence?

Thanks in advance
Rocket Boy is offline   Reply With Quote
Old 11-06-2005, 10:59 PM   PM User | #2
jkd
Senior Coder

 
jkd's Avatar
 
Join Date: May 2002
Location: metro DC
Posts: 3,163
Thanks: 1
Thanked 18 Times in 18 Posts
jkd will become famous soon enough
Code:
function next() {
    /\/([^\/\d]+)(\d+)\.html$/.exec(location.href);
    location.href = RegExp.$1 + (parseInt(RegExp.$2,10)+1) + ".html";
}
As long as your page filenames only have digits immediately before .html, that should probably do the trick.
__________________
jasonkarldavis.com
jkd is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
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

Forum Jump


All times are GMT +1. The time now is 02:58 PM.


Advertisement
Log in to turn off these ads.