[thelist] have a number increase on a webpage over time

Matt Warden mwarden at gmail.com
Mon May 21 17:45:37 CDT 2007


On 5/21/07, Nan Harbison <nan at nanharbison.com> wrote:
> Anyway, I have tried several ways of doing this, none of which worked except
> putting it as an include on each page, where the include refreshes. (it is
> under the header and doesn't show when the count is 0). I set it to refresh
> every 3.6 seconds because one child somewhere in the world dies of
> malnutrition every 3.6 seconds and it was working fine. But when you use
> Internet Explorer, every time it refreshes it makes that annoying clicking
> sound. So I set it to only refresh every 30 seconds, which
>
> So the question is, is there any way to make IE shut up? Or is there a
> better way to do this?

Assume that there is a span that is referenced to the javascript
variable countSpan.

This is not the fully "correct" way to do it, but it will get you in
the right direction.

function incrementCount()
{
   countSpan.innerHTML = (+countSpan.innerHTML) + 1;
}

window.onload = function() {window.setInterval(incrementCount, 3600);}

The span needs to look like this in the markup:

<span>0</span>

-- 
Matt Warden
Cleveland, OH, USA
http://mattwarden.com


This email proudly and graciously contributes to entropy.



More information about the thelist mailing list