I'm trying to do something like this:
if (this.url=='page2.html'){
document.write('<input type=button value="next" onclick="this.url='page3.html'">');
document.write('<input type=button value="prev" onclick="this.url='page1.html'">');
That doesn't work for starters, but more than that I want to be able to access the page name, "page2" in this case, extract the number and then use it to auto generate the next and back buttons.

I'm finding this hard. I'm sure this is a common script type, but I can't find out how to do it. Can anyone help?