I'd like to construct a ticker showing the number of current people online AND making it tick up each second by the known increase.
I already have a ticker for the number of mobile phones sold since a visitor opens a webpage:
Code:
function plusOne() {
var inputEl = document.getElementById('inputEl');
inputEl.value = parseInt(inputEl.value) + 1;
}
var stop = setInterval("plusOne()",0033);
window.onload = plusOne;
But that starts at a zero base level.
So I'd like to make a script to
a) specify a base level of say 2 billion, for a particular recent date when the
stat experts say was that tipping point.
b) work out how many milliseconds have elapsed since that date up to today's
date and time
c) divide that by the known number of new people going online. Let's say one new
person every 250 milliseconds. Then add that total of people since the specificed date to the base level.
d) that creates a base level of slightly over 2 billion as a starting point for when
the page is opened.
e) then have that number continue to tick up at 4 more every second using code
similar to what I have above.
I'm sure the sums can be done with stuff like var d = new Date();
and
var ms = (Date.parse(d));
but I'm not up to knowing how!
Thanks for any pointers in the right direction.
Tony