Back button link delay

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Dmal
    New Member
    • Jan 2011
    • 3

    Back button link delay

    Im trying to set up an image link that has a delay before it sends the user back one step in its history. Ive found a number of examples, most using setTimeout, but there doesnt appear to be any way to merge this function with history.go(-1) within the confines of a link. So far this seems to be the closest example i have found, though it just gives me a "page not found 'javascript();' in FF.

    Code:
    <a href="javascript();" onClick="setTimeout('history.go(-1)', 5000); return false">
    <img src="images/back.jpg" width="50" height="25" alt="Go back in 5 seconds"></a>
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    you could try
    Code:
    <button type="button" id="back">
        <img src="http://bytes.com/images/back.jpg" width="50" height="25" alt="Go back in 5 seconds">
    </button>
    Code:
    document.getElementById("back").onclick = function (evt) {
        setTimeout("history.go(-1)", 5000);
    };
    technically, you don’t even deed the button or the link.

    Comment

    Working...