www.webdeveloper.com
Results 1 to 3 of 3

Thread: [RESOLVED] Neep Help: Timer that counts increments of 75 seconds.

  1. #1
    Join Date
    May 2009
    Posts
    3

    resolved [RESOLVED] Neep Help: Timer that counts increments of 75 seconds.

    I have tried modifying count up timers with no luck... just don't have enough JS knowledge.

    Suppose a specific event occurs every 75 seconds, (An angel gets its wings, a squirrel finds a nut, etc.) and it has been happening since a specific date - for example, April 28th, 2003.

    I need a ticker that can show how many times the 75 second increment has happened, since that specific date.

    It seems like it should be terribly easy, there are lots of apps that track how many seconds have occurred since a specific date, and I should be able to just manipulate the variable for one day to be 1152 seconds, instead of the typical oneDay = 1000 * 60 * 60 * 24

    I have failed horribly, over and over.

    Lastly I would like for it to update at those intervals, and I think I can do it by modifying this code:

    setTimeout(function(){thisobj.start()}, 1000)

    To setTimeout(function(){thisobj.start()}, 75000)

    yes?

    Many thanks for any help you can provide!

  2. #2
    Join Date
    Jun 2004
    Location
    Portsmouth UK
    Posts
    2,682
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    
    <head>
      <title></title>
    <script language="JavaScript" type="text/javascript">
    /*<![CDATA[*/
    
    var Srt=new Date(2009,0,1,0,0,0,0);
    function Cnt(id,srt,sec){
     this.srt=srt;
     this.obj=document.getElementById(id);
     this.ms=sec*1000;
     this.to=null;
     this.cnt();
    }
    
    Cnt.prototype.cnt=function(){
     var oop=this;
     this.obj.innerHTML=Math.floor((new Date()-this.srt)/this.ms);
     this.to=setTimeout(function(){ oop.cnt(); },this.ms);
    }
    /*]]>*/
    </script></head>
    
    <body onload="var oop=new Cnt('tst',Srt,75);var oop=new Cnt('tst1',Srt,2);">
    
    <span id="tst" ></span> - 75 Seconds
    <br />
    <br />
    <span id="tst1" ></span> - 2 Seconds
    
    </body>
    
    </html>
    Vic

    God loves you and will never love you less.

    http://www.vicsjavascripts.org/Home.htm
    If my post has been useful please donate to http://www.operationsmile.org.uk/

  3. #3
    Join Date
    May 2009
    Posts
    3
    Ah ha!

    My most sincere and grateful thanks!

    You, vwphillips, have saved my bacon.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles