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 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jan 2009
    Posts
    1
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Question Help with a timed Swap Image and auto redirect

    Help appreciated please..

    I want (image1) to display on the page and then after a desired time, lets say 4secs, swap to (image2). I would like (image2) to be visible for another timed period, lets say 3secs, when I'd like the page to automatically load another URL.

    I have used this solution to ultimately load in the new page (http-equiv="refresh" content="5;example.htm") but when a visitor is viewing a sequence of google translated pages, when a page with this code is loaded, it stops the translation.

    thanks in advance

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,150
    Thanks
    203
    Thanked 2,547 Times in 2,525 Posts
    Here you are:-
    Code:
    <body onload = "setTimeout('change()',4000)">
    
    <div id = "imgplace"><img src = "one.gif" id = "prm"></div>
    
    <script type="text/javascript"> 
    
    function change() {
    document.getElementById("prm").src="two.gif";
    setTimeout("window.location.href = 'http://www.anotherpage.com';", 3000);
    
    }
    
    </script>

    BTW, the time to say "thanks" is afterwards, not beforehand which gives the impression that you take other people's unpaid assistance for granted. Or as British politician Neil Kinnock put it, "Don't belch before you have had the meal." Prefer to use "please" beforehand and if you find a response helpful then you can use the "Thank User For This Post" button.

  • Users who have thanked Philip M for this post:

    willinSpain (01-17-2009)


  •  

    Posting Permissions

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