JRS: In article <
[email protected]>, dated
Sat, 18 Mar 2006 09:42:02 remote, seen in Ian
Rastall said:
I do a site where I have a previous and next link at the bottom of
every page. It looks like:
<p><a href="foo01.html">Previous</a> | <a href="foo03.html">Next</a></p>
Seeing as they're always in sequential order, is there a way to
automagically go to the previous file or the next file using JS?
You say elsewhere that you are editing 2500 pages manually.
Assuming you have access to DOS, Windows, or UNIX, you should be able to
do many repeated edits with MiniTrue.
Number your pages from, say, 10000 or 1000000 and then you will never be
troubled by leading zeroes.
If you have access to DOS or Windows, then COLS, via
<URL:
http://www.merlyn.demon.co.uk/programs/00index.htm>,
should be able to generate a batch file to rename them ...
and a MiniTrue command file to alter all the extant links.
Use script to write that paragraph, and then in the absence of script it
will not appear; be sure to have always a link to the index page.
The script on each page should just be like
<script type="text/javascript"> LastNext() </script>
with function LastNext() defined in an Include file as in
<URL:
http://www.merlyn.demon.co.uk/js-nclds.htm>.
To get the current page number, try
var N = +location.href.match(/(\d+)\.html/)[1]
To construct a new name
vat S = "foo" + (N+1) + ".html"