Change div's after 10 seconds?

Discussion in 'PHP' started by anversli, Feb 29, 2008.

  1. #1
    Hi,

    Is it possible to change a div's after 10 seconds?

    For example:
    Display a banner for 10 seconds before loading the content and after 10 seconds hide banner and show content at the same place.
     
    anversli, Feb 29, 2008 IP
  2. Wuiqed

    Wuiqed Well-Known Member

    Messages:
    110
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    108
    #2
    That would be done with javascript. However, if the visitor has javascript turned off the ad (or the content, depending on how you've set it up) won't be served.

    You could use an interstitial page with the ad and redirect the visitor to the content after 10 seconds, which is a quite common albeit annoying practice.
     
    Wuiqed, Feb 29, 2008 IP
  3. Barti1987

    Barti1987 Well-Known Member

    Messages:
    2,703
    Likes Received:
    115
    Best Answers:
    0
    Trophy Points:
    185
    #3
    You could use iframe with meta tag refresh to a script.

    Peace,
     
    Barti1987, Feb 29, 2008 IP
  4. bartolay13

    bartolay13 Active Member

    Messages:
    735
    Likes Received:
    14
    Best Answers:
    1
    Trophy Points:
    98
    #4
    Do you refresh your page in every 10secs??
    - if you do, it can be done in php itself, with a <meta refresh=10> tag.
    other method.
    This can be done with Ajax. only a target div container refreshes in 10 every 10 secs.
     
    bartolay13, Feb 29, 2008 IP
  5. lephron

    lephron Active Member

    Messages:
    204
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    53
    #5
    The javascript code to invoke a function after 10 seconds is:

    setTimeout( function() { /* update div code here */ }, 10000);

    To get that to run when the page loads do:

    <script type="text/javascript">
    window.onload = setTimeout( function() { /* update div code here */ }, 10000);
    </script>
     
    lephron, Mar 2, 2008 IP