Hi,
I would like to place on the end of the URL a list of the previous pages a person has been to so a back button can be created to go to the previous page. The javascript:history.back() does not always work correctly because the pages have named anchors( <a name="a"> <a href="#a">)on them.
I can do this for 1 back by placing the current page name on any links away from the page eg. <a href="page2.html?from=page1.html">next</a>.
Then on page2. the next link I would like to be somthing like this <a href="page3.html?from=page2.html&back1=page1.html">
Is there code out to do this?, if not would it be easy to work out. (Im not to good at javascript yet)
The following code I use for the first pages, but not the following ones,
I would like to place on the end of the URL a list of the previous pages a person has been to so a back button can be created to go to the previous page. The javascript:history.back() does not always work correctly because the pages have named anchors( <a name="a"> <a href="#a">)on them.
I can do this for 1 back by placing the current page name on any links away from the page eg. <a href="page2.html?from=page1.html">next</a>.
Then on page2. the next link I would like to be somthing like this <a href="page3.html?from=page2.html&back1=page1.html">
Is there code out to do this?, if not would it be easy to work out. (Im not to good at javascript yet)
The following code I use for the first pages, but not the following ones,
Code:
<script language="javascript">
//<!-- do not change any of this script
var searchString = document.location.search.substring(1);
var nameValuePairs = searchString.split("&");
var params = new Array();
for ( var i=0; i< nameValuePairs.length; i++){
var dataValues = nameValuePairs[i].split("=");
var name = dataValues[0];
var value = dataValues[1];
params[ name ] = unescape( value );
}
// -->
</script>
</body><body>
<script>
if(params["from"])
document.writeln("<a href='" + params["from"] + "' class='button'>Back</a><br />");
else
document.writeln("<a href='javascript:history.back()' class='button'>Back</a><br />");
</script>