It is a little unclear to me what you mean by the terms:
concatenating
subtract or add to it
adding anchors to each page entry
in the context of your message. Which of these operations would be accomplished by javascript, which would be accomplished as hard coded features of the HTML source code via editing it?
If you have anchors on a page like (anchor names should begin with letters):
HTML Code:
<a name="m0"></a>
and later:
HTML Code:
<a name="m1"></a>
and so on. You could have a function on or associated with the page:
Code:
function navToAnchor(d){
var na=document.getElementsByTagName('a');
for (var ul, i = 0; i < na.length; i++)
if(/^m\d+$/.test(na[i].name))
ul=na[i].name.replace(/m/,'')-0;
var h=location.hash.replace(/#m/,'')-(-d);
if(h>-1&&h<=ul)
window.location.hash='m'+h;
}
You could have buttons:
HTML Code:
<input type="button" onclick="navToAnchor(1);" value="Next">
<input type="button" onclick="navToAnchor(-1);" value="Previous">
or links:
HTML Code:
<a href="javascript:void()" onclick="navToAnchor(1);return false;">Next</a>
<a href="javascript:void()" onclick="navToAnchor(-1);return false;">Previous</a>
You wouldn't even need to have a hash when you first get to the page, that would be the equivalent of having it as #m0.
Bookmarks