javascript counter using seconds

Hello
  I want to create a counter that acts something like a clock.  The logic is this, a person dies from smoking every 8 seconds.  I want to know how many have died just this year - somewhere around 950,400 so far this year.  I would like to include the 'clock' on a website.

Thanks a ton!
JG
LVL 2
JGoyerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Pravin AsarPrincipal Systems EngineerCommented:
<html>
<head>
<title>Counter Document</title>
</head>

<body onLoad="MyCounter(); window.setInterval(MyCounter,8000);">
<script language="javascript">
function MyCounter () {
      var dt1 = new Date ('01/01/2006');
      dt1.setMinutes(0);
      dt1.setHours(0);
      dt1.setSeconds(0);
      var dt2 = new Date ();
      var diff = dt2 - dt1;
      //alert ('Number of people ' + (parseInt (diff)/(8*1000)).toFixed(0));
      var spanObj = document.getElementById('counter');
      if (spanObj) {
            spanObj.innerHTML = 'Number of people ' + (parseInt (diff)/(8*1000)).toFixed(0);
      }
}
</script>
<span id="counter">GO HERE </span>
</body>
</html>

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Pravin AsarPrincipal Systems EngineerCommented:
JGoyer,

Just follow-up.. does my solution useful ??

_PA
JGoyerAuthor Commented:
awesome!  thanks!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.