need a back-a-page link

  • 1
  • Question
  • Updated 9 years ago
  • Answered
i need a back-a-page link just like the one at the top-left corner of your internet browser
Photo of mE

mE

  • 45 Posts
  • 0 Reply Likes
  • wondering-full-ish

Posted 9 years ago

  • 1
Photo of lambofgod

lambofgod

  • 875 Posts
  • 35 Reply Likes
Try this :)
<!--
<body> <a href="#" onClick="history.go(-1)">Back</a>
-->
Photo of mE

mE

  • 45 Posts
  • 0 Reply Likes
I put it into html, and its working, but when i click on the text (testing my page) it doesn't do anything.(like a blank link) (Also, when i type in the arrow things (<!-- and -->, it makes no text appear.)
Photo of Sanja

Sanja, Official Rep

  • 10698 Posts
  • 495 Reply Likes
Hi mE... please don't include the <!-- and --> in your HTML widget. They're just there to keep the code from working on the forum. =)
Photo of mE

mE

  • 45 Posts
  • 0 Reply Likes
never mind i got it working. its: history.go(-2)
not: history.go(-1)
-1 takes you to the top of the page.
Photo of Boomer

Boomer, Champion

  • 2055 Posts
  • 84 Reply Likes
Rather use this one mE,
<a href="javascript:history.back()">BACK</a>
Photo of mE

mE

  • 45 Posts
  • 0 Reply Likes
i tried that and it worked better.(thanks) Also just asking, do you know how to make it go to the top of the page not using the code I used before because it might work better.
Photo of mE

mE

  • 45 Posts
  • 0 Reply Likes
never mind .... this works
<!--
<body> <a href="#" onClick="gototop"">Go to top...</a>
-->

works
Photo of Boomer

Boomer, Champion

  • 2055 Posts
  • 84 Reply Likes
I have not tried this one mE, but you can give it a try if you want.

<a href="#" onclick="window.scrollTo(0,0); return false">Back to Top</a>

If you are going to use your one above, leave out the <body> tag.
Photo of UK Duke

UK Duke, Champion

  • 3321 Posts
  • 213 Reply Likes
are you sure you need back a page or would something like this not work better:

see the arrows at the bottom of the page:
http://yolacodes.yolasite.com/togglec...
Photo of mE

mE

  • 45 Posts
  • 0 Reply Likes
it works on safari and firefox so it ok i guess
Photo of mE

mE

  • 45 Posts
  • 0 Reply Likes
i already have it working if you had read the comment i posted....

<!--
<body> <a href="#" onClick="history.go(-1)">Go to top...</a>
-->

goes to the top of the page and

<!--
<body> <a href="#" onClick="history.go(-2)">Back</a>
-->

goest back a page.

All done
Photo of UK Duke

UK Duke, Champion

  • 3321 Posts
  • 213 Reply Likes
I would suggest using Boomers code its a lot cleaner - really the -2 means back 2 pages - im sure in some situations in some browsers the code your using would be mis read and cause problems.

Lee.
Photo of Kershnee

Kershnee

  • 2087 Posts
  • 152 Reply Likes
Hi Me - Well done on getting it to work. Let us know if you need any other help.
Photo of mE

mE

  • 45 Posts
  • 0 Reply Likes
I tried Boomer's code and it worked a lot better thanks
Photo of UK Duke

UK Duke, Champion

  • 3321 Posts
  • 213 Reply Likes
hate to say i told you so :) -- i could see it was a better code - glad to see you saw the light.
Now im intrested in seeing this site - is it ready for public viewing?
Photo of mE

mE

  • 45 Posts
  • 0 Reply Likes
no sorry.. It probably wouldn't interest you though unless you know about a game called SketchFighter 4000 Alpha... Its really had so I thought I could post a site on how to beat the career....