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

    adding a timed counter to a web page

    I would like to add a counter to help stress what I am writing about. I would like the counter to add 1 to the count every 3 seconds.
    As in....since you have been reading this (counter goes here)birds have fallen out of trees.

    I would like the counter to appear as normal text (different colour) if that is at all possible. Thank You

  • #2
    Regular Coder
    Join Date
    Feb 2003
    Posts
    638
    Thanks
    0
    Thanked 0 Times in 0 Posts
    something like this?
    Code:
    <html>
    <head>
    <title>-</title>
    <script type="text/JavaScript">
    var birds = 2;
    window.onload = function update(){
    birds++;
    setInterval(function(){
    document.getElementById("counter").innerHTML = birds++; 
    }, 3000);}
    </script>
    <style type="text/css">
    #counter{
    font-weight:bold;
    color:highlight;
    }
    </style>
    </head>
    <body>
    <p>
    Since you have been reading this, <span id="counter">2</span> birds have fallen out of their nest!
    </p> 
    </body>
    </html>
    Last edited by swmr; 03-29-2004 at 11:31 PM.
    hmm... ?

  • #3
    New to the CF scene
    Join Date
    Mar 2004
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    That is absolutely brilliant!!!! Thank you so much for your help.


  •  

    Posting Permissions

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