PDA

View Full Version : Back button link



yoshi555
01-08-2007, 02:58 AM
1) CODE TITLE: Back button

2) AUTHOR NAME/NOTES: Yoshi555

3) DESCRIPTION: Put a back linkyour page

4) URL TO CODE:
<script>
<!--
document.write(unescape("%3Ca%20href%3D%22history.back%281%29%22%3E%20Back%20%3C/a%3E"));
//-->
</script>To make a forward link on your webpage
<script>
<!--
document.write(unescape("%3Ca%20href%3D%22history.forward%281%29%22%3E%20Forward%20%3C/a%3E"));
//-->
</script>

or, ATTACHED BELOW (see #3 in guidelines below):

djr33
01-08-2007, 03:26 AM
Sure... seems like that would work.
But, really, it's just too simple to be worth much to that many people.
You're welcome to wait to see if someone else thinks differently.

yoshi555
01-08-2007, 03:28 AM
Can you make it into a button i know how but i think if you do it it would be better

djr33
01-08-2007, 03:38 AM
A button? Based on an image? Or based on an input button?

<a href="history.back(1)"><img src="button.gif"></a>

Or, <input type="button" onClick="goback();">

and

function goback() {
document.location = 'history.back(1)';
}


Untested... but... generally, that should work.

Javascript isn't really my area... I do more PHP.

Twey
01-08-2007, 05:02 AM
function goback() {
document.location = 'history.back(1)';
}

Untested... but... generally, that should work.No it shouldn't :)
<button onclick="history.back();">Back</button>However, I don't see how it merits mentioning. It certainly isn't nearly complex enough to be added to the script archives, in my opinion.

yoshi555, please validate (http://validator.w3.org/) your code.

jscheuer1
01-08-2007, 05:17 AM
There is another issue here, one that mwinter kept raising whenever something like this would come up. It is tempting to use javascript in this fashion but, it renders your navigation sub standard in non-javascript enabled browsers or, even useless if it is depended upon too heavily as will always be the case once a novice or two gets a hold of this code. Good enough reason for me to say, "Don't use it unless you really know what you are doing and above all don't make it a script for novices."

djr33
01-08-2007, 07:07 AM
Yeah... well, I was guessing he actually posted the right thing to use as the url. Oops. ;)

ddadmin
01-08-2007, 12:32 PM
Yep, this script is definitely too simple to justify staying up. However, since there are a number of replies to the thread already, I'll keep it going.