SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Zealot
    Join Date
    Dec 2002
    Location
    vancouver, bc
    Posts
    134
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    history.back problems

    hi,

    I got this back button that uses this code:

    <button type="button" onclick="history.back();">Back</button>

    it worked then it stopped working. what can cause it not to work?

    i've had this problem before but couldn't solve it. like my form buttons would sudden stop working.

    even if i don't use form buttons it doesn't work but if you press back on my browser it works.

  2. #2
    Word Painter silver trophy Shyflower's Avatar
    Join Date
    Oct 2003
    Location
    Winona, MN USA
    Posts
    10,054
    Mentioned
    142 Post(s)
    Tagged
    2 Thread(s)
    Try this instead:

    <input type=button value="Back" onClick="history.go(-1)">

    You can replace the (-1) with a different number if for some reason you want to.
    Linda Jenkinson
    "Say what you mean. Mean what you say. But don't say it mean." ~Unknown

  3. #3
    SitePoint Zealot
    Join Date
    Dec 2002
    Location
    vancouver, bc
    Posts
    134
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    nothing, just no effect. my other js functions work though

  4. #4
    Word Painter silver trophy Shyflower's Avatar
    Join Date
    Oct 2003
    Location
    Winona, MN USA
    Posts
    10,054
    Mentioned
    142 Post(s)
    Tagged
    2 Thread(s)
    You don't need javascript to use that particular link. HTML will do the trick
    Linda Jenkinson
    "Say what you mean. Mean what you say. But don't say it mean." ~Unknown

  5. #5
    SitePoint Zealot
    Join Date
    Dec 2002
    Location
    vancouver, bc
    Posts
    134
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i know but i need to put it into an input button since all the other ones are like that.

  6. #6
    Word Painter silver trophy Shyflower's Avatar
    Join Date
    Oct 2003
    Location
    Winona, MN USA
    Posts
    10,054
    Mentioned
    142 Post(s)
    Tagged
    2 Thread(s)
    There should be a button when you use that code. If you noticed it begins:

    <input type=button
    Linda Jenkinson
    "Say what you mean. Mean what you say. But don't say it mean." ~Unknown

  7. #7
    SitePoint Addict
    Join Date
    Jul 2002
    Location
    Sooner Nation
    Posts
    208
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I had the same trouble and just used this.
    Code:
    <script language="JavaScript"><!-- 
    document.write ("<a href=" +document.referrer+  "><img src=""images/back.gif border=0 width=112 height=31 alt=></a>");
    -->
    </script>
    The only function of business is to create customer value and to innovate. - Peter Drucker


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •