I have a series of pages (e.g. page1.html, page2.html, page3.html, page4.html) and I need a javascript to generate next and prev buttons.

In order to do this I'm using a script that goes something like this (it doesn't work so this is just the idea of it).

Code JavaScript:
      document.write('<input type=button value="Next" onclick="this.href='page2.html'">');

There are 2 issues I'm having.

The first is that unless I put the full url (e.g. "C://web/page1.html") the document.write doesn't run. I need to be able to test the actual page reference, not it's full path as this is local and will be uploaded.

The second is how to get the changing next button href to essentially be page1.html + 1, page[n].html +1 if you like.