HTML Code Timed Delay Help

Discussion in 'HTML & Website Design' started by mmmaster, Jul 24, 2011.

  1. #1
    What I am trying to do is simple, and I have seen it one before online just cant remember where.

    Say you load the Homepage, and on my sidebar I have an HTML code to a picture of a car.

    The code that I am looking for does this:

    Page Loads > XXX whatever amount of time I set > HTML code appears.

    So if I were to set it to 1 minute, the homepage would show up just fine, and 1 minute later the HTML image or whatever HTML shows up.

    Do you know that code?

    Thanks!
     
    mmmaster, Jul 24, 2011 IP
  2. PHP Junior

    PHP Junior Peon

    Messages:
    47
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    HTML is static. Are you talking about Javascript setTimeout("function()", 1000) ( just an example ) ?
     
    PHP Junior, Jul 24, 2011 IP
  3. mmmaster

    mmmaster Guest

    Messages:
    62
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    you're right!, and i think thats just what I need how do I set it up? where do I put the HTML code? and the time to wait before it comes in, and out? and in addition, can i set it so that it leaves and comes back in say another 10 minutes?

     
    mmmaster, Jul 24, 2011 IP
  4. dthoai

    dthoai Member

    Messages:
    106
    Likes Received:
    2
    Best Answers:
    1
    Trophy Points:
    38
    #4
    You can use following codes. Change variable 'comein', 'comeout', 'comeback' to your time (in milliseconds).

    
    <html>
    <script>
    var comeback = 600000;
    var comein = 60000;
    var comeout = 60000;
    function showFlash() {
      var tag = document.getElementById('flash');
      tag.style.display = 'block';
      setTimeout('hideFlash()', comeout);
    }
    function hideFlash() {
      var tag = document.getElementById('flash');
      tag.style.display = 'none';
      setTimeout('showFlash()', comeback);
    }
    </script>
    <body onload="setTimeout('showFlash()', comein)">
    <div style="border: solid 1px red;width:500px;height:200px;">
    Static elements go here!
    </div>
    <div id="flash" style="border: solid 1px red;width:300px;height:200px;display:none;">
    Dynamic elements go here!
    </div>
    </body>
    </html>
    
    Code (markup):
     
    dthoai, Jul 24, 2011 IP