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

    help with iframe timer

    hi , im newbie here and need some help from all the guru here ,
    can some 1 help me out with iframe , i want an iframe can do auto reload on list sites after specific time , example after 10 seconds ifram will open google.com and after 10 seconds again iframe will reload yahoo.com and so on.
    please some one help me , i had try to search on google and others but still can find it ,
    i apreciate all the help thank you

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,200
    Thanks
    75
    Thanked 4,342 Times in 4,308 Posts
    *COMPLETEL* untested, but try something like this:
    Code:
    <script type="text/javascript">
    // create an array with as many urls for the iframe as you wish:
    var urls = ["http://www.google.com","http://www.yahoo.com","http://www.ask.com"];
    var current_url = 0;
    
    function nextUrl( )
    {
        document.getElementById("TheIframe").src = urls[current_url % urls.length];
        ++current_url;
        setTimeout("nextUrl()", 10000); // 10 seconds
    }
    </script>
    ...
    <body onload="nextUrl( )">
    ...
    <iframe id="TheIframe"></iframe>
    ...
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #3
    New to the CF scene
    Join Date
    Dec 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thank you bro i'll try it


  •  

    LinkBacks (?)


    Posting Permissions

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