Another useful, but simple tech tip
If you’re a regular reader you’ve seen me use forward and back buttons on occasion. I usually use them when I post something that requires an Iframe (an inline frame). You can see an example of this on my MyBlogLog exchange post here, and on my blogcatalog exchange post here. You’ll notice no forward buttons since clicking the link you want will take you forward, the back button is key but it can’t hurt to know how to do both.
The standard “form” method:
Here’s the code for the back button (looks like this:
)
<input TYPE=“button” VALUE=“Back” onClick=“history.go(-1);return true;”/> </form>
Here the code for the forward button (looks like this:
)
<input TYPE=“button” VALUE=“Back” onClick=“history.go(1);return true;”/> </form>
You can change the text in the buttons by simply changing the VALUE field (i.e. “Return”, “I wanna go back!”, whatever you want).
The Java script method:
Looks the same as the form method. I actually prefer the form version above as it’s less code to enter, but thought I’d share both ways of doing it.
First place the code below anywhere in your body.
<SCRIPT LANGUAGE="JavaScript">
<!-- Hide this from older browsers
function goForward() {
window.history.forward();
}
function goBack() {
window.history.back();
}
// end hide –>
</SCRIPT>
Next, place the code below where you want the button(s) to go. If you don’t want both buttons simple don’t include the blue line of code for the back button, red code for forward (same with the above code).
<FORM TARGET=”_self”>
<INPUT TYPE=”submit” VALUE=”Back” onClick=”goBack()”>
<INPUT TYPE=”submit” VALUE=”Forward” onClick=”goForward()”>
</FORM>
Again, you can change the button text by changing the VALUE field.
Note: copy the code into notepad first, then copy to your post/page - this goes for any code you copy and paste (keeps hidden attributes from being copied).
That’s all there is to it! Comment below if you have any questions.
Like this blog? Sweet! Wanna help a guy out & buy me a cup of coffee?If you liked this post,do me a favor and
Stumble it! Thanks!














5 responses so far ↓
1 Tina Russell // Apr 23, 2008 at 1:00 pm
I finally decided to write a comment on your blog. I just wanted to say good job. I really enjoy reading your posts.
Tina Russell
[Reply]
2 Sunduvan // Apr 24, 2008 at 7:59 am
Hi, check out my free review for this blog in my blog at http://freeblogreview.blogspot.com see you there.
[Reply]
Ty Hurd reply on April 24, 2008:
LOL - that has to be about the oddest review I’ve ever received… Thanks for the mention though!
[Reply]
3 Louis Liem // Apr 24, 2008 at 9:07 am
How do they appear on feeds?
[Reply]
Ty Hurd reply on April 24, 2008:
They look like this: [Back]
You can’t go back and forth in an email. If your post has frames and/or buttons you could make a note in the post that your readers will have to visit your blog for full functionality…
[Reply]
Leave a Comment