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
    Aug 2010
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Smile Delay before timer starts

    Hello
    I have a question, I bet it's easy for you guys.

    I have a page "v.php" which's got an iframe that shows different pages for 3 seconds after they have loaded.

    There is a page "w.php" that needs to be shown in the iframe but it needs to be shown for 10 seconds after it's loaded.

    How can I make so "w.php" freezes the timer for at least 10 seconds and then let it start?


    I hope you guys can understand.

    Thanks!

  • #2
    Regular Coder
    Join Date
    Feb 2009
    Location
    Wheeling, IL
    Posts
    358
    Thanks
    5
    Thanked 62 Times in 60 Posts
    How does the timer run in the first place? How is the page in question loaded? While we may be able to understand exactly what you're saying, we can't guess what your code looks like or how you're doing something. Please provide a code snippet next time.
    The way to success is to assume that there are no impossible things. After all, if you think something is impossible, you will not even try to do it.

    How to ask smart questions?

  • #3
    New to the CF scene
    Join Date
    Aug 2010
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Eldarrion View Post
    How does the timer run in the first place? How is the page in question loaded? While we may be able to understand exactly what you're saying, we can't guess what your code looks like or how you're doing something. Please provide a code snippet next time.
    Thank you very much for your reply.

    Here are the codes of the php which contains the iframe:


    Javascript code:
    Code:
    <script type="text/javascript">
    function include(file) {
    	var head = document.getElementsByTagName('head').item(0);
    	var old  = document.getElementById('lastLoadedCmds');
    	if (old) head.removeChild(old);
    
    	script = document.createElement('script');
    	script.src = file;
    	script.type = 'text/javascript';
    	script.defer = true;
    	script.id = 'lastLoadedCmds';
    	void(head.appendChild(script));
    }
    
    var secs = ({$set['seconds']});
    var tway=1;
    
    function startTimer()
    {
     if(secs==0)
     {
     include("cmp.php?complete&amp;");
     } else {
     secs=secs-tway;
     setTimeout("startTimer()", 1000);
     }
    document.getElementById('secs').innerHTML = secs;
    }
    </script>

    The body:
    Code:
    <body style = "margin:0px; position:absolute; width:100%;" onload = "startTimer()">
    And the iframe:
    Code:
    <iframe id="completedAd" src="{$url}" width="100%" frameborder="0" height="100%" style = "border-bottom: 0px solid #121212;border-left: 0px solid #121212;border-right: 0px solid #121212;" allowtransparency="true" scrolling="auto"></iframe>

    I hope this helped

    Thanks!


  •  

    Tags for this Thread

    Posting Permissions

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