Forum Moderators: open

Message Too Old, No Replies

Writing an HREF sequentially based upon location filename

create link based upon page name

         

Clarkman

2:31 am on Sep 23, 2008 (gmt 0)

10+ Year Member



Hi all

I was quite interested to find this topic:
[webmasterworld.com...]
which has a great way to write the filename of the web page. I'd like to ask for help to perform an expanded function.

I have 79 pages labeled sequentially as ep01, ep02, etc. to ep79

I'd like to dynamically write an href string that bases the target upon the page name +1.

So, for example, if I'm on page ep09.html, clicking the link will load ep10.html.

Then, since there's a maximum page number, if I'm on ep79.html I need to wrap back to ep01.html.

The link will of course be called "next." I cite the previous thread because toadhall came up with a great way to truncate the URL to get the page name.

Thanks for your review.

Fotiman

1:59 pm on Sep 23, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Welcome to WebmasterWorld. This is not really a good use of JavaScript. You should consider using a server-side solution instead, like PHP or ASP (etc.). The reason it's not a good use of JavaScript is because it will not work for users with JavaScript disabled (including, but not limited to, search engines).

Clarkman

12:19 am on Sep 24, 2008 (gmt 0)

10+ Year Member



Thank you. I actually did write it in php for a php sub-page, but I'd like to add a client-side script to an href that exists on the main html page.