Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Jul 2011
    Posts
    37
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Question need help with javascript.

    I want a script that go back in history after 3 sec on loading a page.

    <a href="javascript:history.go(-1)">Go back</a>
    This script let you go back in history but i want that its automatically execute after 3 sec.

    Please help.

  • #2
    Senior Coder DanInMa's Avatar
    Join Date
    Nov 2010
    Location
    Salem,Ma
    Posts
    1,577
    Thanks
    13
    Thanked 248 Times in 248 Posts
    try adding this to the <head> section


    Code:
    <script type="text/javascript">
    function go_back() {
    var t=setTimeout("history.go(-1)",3000)
    
    }
    window.onload = go_back;
    </script>

  • Users who have thanked DanInMa for this post:

    Prashank (07-23-2011)

  • #3
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,184
    Thanks
    10
    Thanked 569 Times in 550 Posts
    that sounds in-accessible and really annoying...

    look into setTimeout if you dare.
    my site (updated 13/9/26)
    BROWSER STATS [% share] (2014/1/19) IE7:0.2, IE8:6.7, IE11:7.4, IE9:3.8, IE10:4.4, FF:18.3, CH:43.6, SF:7.8, MOBILE:27.5

  • #4
    New Coder
    Join Date
    Jul 2011
    Posts
    37
    Thanks
    3
    Thanked 0 Times in 0 Posts
    THANK YOU
    You have solved my problem. I need it for automatically closing the lightbox.

    many many many thanks for this.


  •  

    Posting Permissions

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