Linking Questions

liunx

Guest
1. What's the code added if I want to have a link (either a text or an image) when you want to Go back to the Previous linked bookmark within the same page (i think that was kinda redundant)<br />
<br />
2. What if the link took the viewer to a different/another page but you still want them to be able to go Back to the Previously viewed page or bookmark...without having to click on the Back button of the browser? Is there a way to create a link (text or image -) within that page to go back (in the same window/frame) A sort of Back - Forward button?<!--content-->Originally posted by Dave Clark <br />
Do you mean this?<br />
<br />
<button onclick="window.history.go(-1)">Back</button><br />
<button onclick="window.history.go(+1)">Forward</button><br />
<br />
Dave <br />
<br />
1. Thanks! But what if I don't want it to a button (they seem pretty dull) but just a text link or an image link back& forward??<br />
<br />
2. Also, does the above also apply to going back to previous view within the same page?<!--content-->Keeping in mind that one in ten times or more JavaScript will not work (<!-- m --><a class="postlink" href="http://www.thecounter.com/stats/2002/November/javas.php">http://www.thecounter.com/stats/2002/November/javas.php</a><!-- m -->) we can divide instances of JavaScript use into three categories. Some uses are harmful, some are mostly harmless and some are completely harmless. JavaScript dependent navigation is an example of a harmful use. It will make a site useless for a great number of people. A JavaScript generated date stamp might be an example of a completely harmless use if the date stamp will not be missed by those who do not see it. Your buttons or links fall into the middle category. Nothing is lost if you omit them, but you really do not want all those JavaScript free people to find seemingly broken links on your page. The solution is to use JavaScript to draw those buttons or links.<br />
<br />
<script type="text/javascript"><br />
<!--<br />
document.write('<p><a href=http://www.webdeveloper.com/forum/archive/index.php/"#">Get Back Jo-Jo</a> | <a href="#">Onward and Upward</a></p>');<br />
document.links[document.links.length-2].onclick = function () {history.back(); return false};<br />
document.links[document.links.length-1].onclick = function () {history.forward(); return false};<br />
// --><br />
</script><!--content-->the normal text links for that would be:<br />
<br />
<a href=http://www.webdeveloper.com/forum/archive/index.php/"javascript:history.go(-1)">Back</a><br />
and<br />
<a href=http://www.webdeveloper.com/forum/archive/index.php/"javascript:history.go(+1)">Forward</a><br />
<br />
<br />
Of course in stead of the words "Back" and "Forward" <br />
you can insert any images.<br />
<br />
Zebedeus<br />
<br />
PS... But Charles is right in principle<!--content-->Originally posted by zebedeus <br />
<a href=http://www.webdeveloper.com/forum/archive/index.php/"javascript:history.go(-1)">Back</a><br />
and<br />
<a href=http://www.webdeveloper.com/forum/archive/index.php/"javascript:history.go(+1)">Forward</a><br />
<br />
<br />
as javascript is not supoposed to go in the href=http://www.webdeveloper.com/forum/archive/index.php/"" I'm sure you ment to write<br />
<br />
<a onclick="history.go(-1)">Back</a><br />
and<br />
<a onclick="history.go(+1)">Forward</a><!--content--><script type="text/javascript"><br />
<!--<br />
document.write('<p><a href=http://www.webdeveloper.com/forum/archive/index.php/"#">Get Back Jo-Jo</a> | <a href="#">Onward and Upward</a></p>');<br />
document.links[document.links.length-2].onclick = function () {top.history.back(); return false};<br />
document.links[document.links.length-1].onclick = function () {top.history.forward(); return false};<br />
// --><br />
</script><!--content-->
 
Back
Top