Need a little piece of website code


  1. Posts : 1,663
    Windows 10 Tech Preview 9926 x64
       #1

    Need a little piece of website code


    Hey guys,
    So, I'm working on the new website for the organization that I work for, and it's coming along really well. The problem that I am having is that, while I know html inside and out, I pretty much know nothing about Java. What I need is a bit of code where I can have a link that will take the person back to the last page they were on. Can anyone help me out?

    Thanks,
    Brian
      My Computer


  2. Posts : 3,322
    Windows 8.1 Pro x64
       #2

    It's pretty simple. JavaScript has the history object. Just off the top of my head, iirc, it's just something like

    Code:
    <a href="javascript:history.go(-1)">Previous Page</a>
    or

    Code:
    <a href="javascript:history.back()">Previous Page</a>
    The number in the parenthesis is the amount of pages to go back in the history, so changing it to -2 would put the user 2 pages back, and so on. Changing it to a positive number, so just 1, 2 etc, lets the user go forward in history.
      My Computer


  3. Posts : 1,663
    Windows 10 Tech Preview 9926 x64
    Thread Starter
       #3

    Awesome, it works great. Thanks Everlong!
    Last edited by blackroseMD1; 06 May 2010 at 14:33.
      My Computer


  4. Posts : 3,322
    Windows 8.1 Pro x64
       #4

    You're welcome :)
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 02:39.
Find Us