Forward and Back buttons are part of most help systems; they are called 'browse sequences' in help author terminology. Not all help files have them, as many subjects are not sequential anyway. I use them in copperfieldpub.com, and others. Its built in to the system.
Here is some Javascript that will fit into a .js file. Place the .js reference wherever you want the browse sequence to display:
<script language="javascript1.2" src="browse.js"></script>
...and the contents of the .js file will look like this, except you will add your own page names and descriptions, of course:
==========================
Page_name=new Array()
Page_desc=new Array()
Page_name[0]="toc.html"
Page_desc[0]="Table of Contents."
Page_name[1]="ch1.html"
Page_desc[1]="Chapter One: Starting the Journey"
Page_name[2]="ch2.html"
Page_desc[2]="Chapter Two: Packing My Stuff"
Page_name[3]="ch3.html"
Page_desc[3]="Chapter Three: Feeding the Fish"
Page_name[4]="ch4.html"
Page_desc[4]="Chapter Four: Turning out the Lights"
Page_name[5]="ch5.html"
Page_desc[5]="Chapter Five: Locking the Door."
Page_name[6]="references.html"
Page_desc[6]="List of References"
//----------------------start------------------------------
NumberOfFiles=Page_name.length;
StringA=location.href;
LengthA=StringA.length
A=StringA.lastIndexOf("/" )+1;
ThisFilename=StringA.substring(A,LengthA);
//--------------------------------------------------------
/*Find the page number*/
n=NumberOfFiles-1;
foundit=false;
for (var i = 0; i <= n; i++)
{
if (Page_name[ i]==ThisFilename) // remove space from brackets (forum fix)
{
ThisPageNumber=i;
foundit=true;
break;
}
if (foundit==false) {
ThisPageNumber=0;
}
}
//determine the numbers of the previous and the next pages
function goPrev(){
if ((ThisPageNumber-1)<0)
{
alert("You are at the beginning of the series" )
}
else
{top.location.href=Page_name[ThisPageNumber-1]
}
}
function goNext()
{
n=NumberOfFiles-1;
if ((ThisPageNumber+1)>n)
{
answer = confirm("You are at the end of the series. \nPress OK to go to the start, or \nCancel to remain where you are" );
if (answer !=0)
{
top.location.href=Page_name[0]
}
}
else
{
top.location.href=Page_name[ThisPageNumber+1]
}
}
// writes the previous and next pages
function NextPreviousWriter()
{
if(Page_name[ThisPageNumber-1])
{
document.write("[<b>Back to: </b><a href="+
Page_name[ThisPageNumber-1]+" title='back to " + Page_desc[ThisPageNumber-1] +"'>"+
Page_desc[ThisPageNumber-1]+"</a>]" );
}
if(Page_name[ThisPageNumber+1])
{
document.write("<br>[<b>On to: </b><a href="+
Page_name[ThisPageNumber+1]+" title='forward to " + Page_desc[ThisPageNumber+1]+"'>"+
Page_desc[ThisPageNumber+1]+"</a>]<br>" );
}
else {
document.write("<br><b>End of series so far. More to come ... "+
"</b><br>" );
}
}
NextPreviousWriter();
==========================
... and there you go.
Don't forget to remove that space from the array definiton above (around line 32) ; its a fix due to this forum messing with my code, despite turning emoticons off. I would ask Sunil to look into it, but I'd rather see 5.0 come out first.
(Edited by Alaska at 1:26 pm on July 13, 2006)