Javascript counter

Discussion in 'JavaScript' started by cipcip, Feb 21, 2009.

  1. #1
    Ok, I am making a swoopo clone from scratch, i mean everyone knows the site www.swoopo.com

    I have made everything but now, since i am not that good with javascript, i don't know how to do that counter that resets everytime a user press bid.

    Any help / ideas ?

    Thank you!
     
    cipcip, Feb 21, 2009 IP
  2. cipcip

    cipcip Well-Known Member

    Messages:
    1,935
    Likes Received:
    19
    Best Answers:
    0
    Trophy Points:
    160
    #2
    no one knows ? :(
     
    cipcip, Feb 24, 2009 IP
  3. cjburkha

    cjburkha Peon

    Messages:
    71
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Here is something kind of simple:
    <html>
    <head>
    <script type="text/javascript">
    function startTimer()
    {
    setTimeout(coutdown, 1000);
    }
    
    function coutdown()
    {
    
    	var timeLeftObj = document.getElementById('timeLeft');
    	timeLeftObj.innerHTML = (parseInt(timeLeftObj.innerHTML) - 1);
    	startTimer();
    }
    
    function resetTimer()
    {
    var timeLeftObj = document.getElementById('timeLeft');
    timeLeftObj.innerHTML = '100';
    }
    </script>
    </head>
    <body onload="startTimer();">
    <input type="button" value="Reset!" onclick="resetTimer();" />
    <br />
    <span id="timeLeft" style="font-size: 32px; font-weight: bold;">100</span>
    </body>
    </html>
    Code (markup):
     
    cjburkha, Feb 24, 2009 IP
  4. gruici

    gruici Banned

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    i l give you the java code for 30 $ yahoo id:gruici_bogdan
     
    gruici, Mar 1, 2009 IP
  5. Joak1m

    Joak1m Peon

    Messages:
    135
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Use PHP and Ajax, much more reliable and reasonable.
     
    Joak1m, Mar 4, 2009 IP