Results 1 to 3 of 3

Thread: plus or add 1 every second

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2002
    Posts
    259

    plus or add 1 every second

    using JavaScript:

    How can I plus 1 to value of this Input box every second.

    <input type=text name=number value=1>

  2. #2
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    Use the setTimeout() function:

    Code:
    setTimeout("addone()", 30);
    Where addone() is your function to add and 30 is the increment you wish to do it at.
    My evil laugh has a squeak in it.

    kristopherwilson.com

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2002
    Posts
    259

    That is my code

    Code:
    <form name=tt>
    <input type=text name=number value=1>
    </form>
    
    <SCRIPT language="JavaScript">
    function Clock()
    {
    NO=tt.number.value+1;
    
    tt.number.value=NO
    }
    ID=setTimeout("Clock()",1000)
    </SCRIPT>

    but it convert 1 to 11 and no effect after that.

    I want to add 1 to value to become 2 and after one second become 3 ... 4 ...5 ...5

Posting Permissions

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



Click Here to Expand Forum to Full Width