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 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Mar 2005
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Javascript Countdown Timer

    I have set up a slideshow that uses both PHP and Javascript. The PHP side of it obviously works on all browsers. However, when the 'Start' button is pressed, it triggers javascript to create countdown timer of 5 seconds, before it moves to the next image.

    This works absolutely fine on IE, but on Firefox - nothing happens.

    Does anyone know of a way round this, or how to create a countdown timer that will function in Firefox/Mozilla?

    You can see the page that works in IE at http://www.gardensbydesignuk.co.uk/gbd/p_hauf.php
    Last edited by benbarnett; 03-04-2005 at 03:36 PM.

  • #2
    Xko
    Xko is offline
    New Coder
    Join Date
    Feb 2005
    Location
    Birmingham, England
    Posts
    68
    Thanks
    0
    Thanked 0 Times in 0 Posts
    My only useful information here is that good old hotscripts.com has 20 javascript countdown timers.

    Maybe one of those will suit your requirements?

    Clicky Clicky!

  • #3
    New to the CF scene
    Join Date
    Mar 2005
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I've done a bit more testing and found that I don't think it's the timer that's causing the problem.

    Here's the JS code.. Start() is called when the start button is clicked.

    Code:
    <script language="javascript1.2">
      var secs;
      var count;
    
    function Start() {
      	secs="5";	
    	setTimeout("countDown()",1000);
    	document.getElementById("play_img").src="images/slide_pause.gif"; 
      	document.getElementById("play_img").alt="Pause Slideshow"; 
      	document.getElementById("play_a").href="javascript:Stop();";
       	document.getElementById("progbar").width="80";
    }
     
    function Stop() {
       if (count) { clearTimeout(count); }
       document.getElementById('play_img').src='images/slide_play.gif';
       document.getElementById('play_img').alt='Start Slideshow'; 
       document.getElementById('play_a').href="javascript:Start();";
       document.getElementById('progbar').width='0';
    }
    function countDown() {
    if(secs==0) { return; }
    secs--;
    document.getElementById('progbar').width=(document.getElementById('progbar').width-(80/5));
    if(secs<1) { nextImage(); return; }
    count=setTimeout("countDown()",1000);
    }
    </script>

  • #4
    New to the CF scene
    Join Date
    Mar 2005
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    No worries.. just made a flash alternative; much better option anyway.


  •  

    Posting Permissions

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