Countdown Timer for game
<p>Hey all, this is the last piece needed for my jquery game. A countdown timer that submits the score when expired and restarts when the play button is clicked.</p>

<p>Here's the game.
The game starts by you entering a number in a text field. then you click the play button.</p>

<p>After clicking the play button a set of squares appear each rotating random numbers, click on the square that has your number to build up your score, miss 3 times and you are done. Can't click the same square twice in a row.</p>

<p>I added the game to my site, you can view it here <a href="http://www.gamerholic.com/pickanumber.php" rel="nofollow">link text</a></p>

<p>the problem I'm having is that my site members will just keep the cursor on one box and wait for their number to appear in that one box. Which ruins the game. Is there a way to make it so they can't click on the same box more than once in a row. They'll have to go click another box before they can come back to this one.</p>

<p>I'm also looking for jquery games to add to my site. This is a site were gamers play for money, so you we'll earn $$ each time someone plays your game.</p>

<p>here's my complete script</p>

<pre><code>    var hitCount = 0,
missCount = 0;

function IsNumeric(n) {
return !isNaN(n);
}

$("#getit").click(function() {
var hitCount = 0,
missCount = 0;
$('#misscount').text(0);
$('#hitcount').text(0);
$('#message').hide(100);        
$('#randomnumber').empty();
$('#randomnumber').show(300);       
var li = [],
    intervals = 0,
    n = parseInt($('#MyNumber').val());

if (IsNumeric(n)) {
   intervalId= setInterval(function() {
        li[intervals++ % li.length].text(Math.random() &gt; .1 ? Math.floor(Math.random() * (10 + n) + (n / 2)) : n).attr('class', '')    ;
    }, &lt;?php echo $time ?&gt;);
}

$('#randomnumber').empty();

for (var i = 0; i &lt; 7; i++) {
    li.push($('&lt;li /&gt;').one('click', function() {
        BoxClick.call(this, n);
    }).appendTo('#randomnumber'));
}


function BoxClick(n) {
var $this = $(this);
$('#randomnumber li').unbind().one('click', function() {
        BoxClick.call(this,n);
});
$this.unbind();

if (!$this.hasClass('clicked')) {
    if (parseInt($this.text(), 10) === n) {
        $this.addClass('correct');
        $('#hitcount').text(++hitCount);
    } else {
        $this.addClass('wrong');
        $('#misscount').text(++missCount);
    }
}
            if(missCount==&lt;?php echo $limit ?&gt;){
               clearInterval(intervalId);
               $('#randomnumber').hide(300);

                $.ajax({
type : 'POST',
url : 'FBhighscore_hwnd.php',
dataType : 'json',
data: {
tgameid: $('#tgameid').val(),MyNumber: $('#MyNumber').val(),totalHits: hitCount
},
success : function(data){
$('#waiting').hide(500);
$('#message').removeClass().addClass((data.error === true) ? 'error' : 'success')
.text(data.msg).show(500);
if (data.error === true)
$('#loginForm').show(500);
else
$('#send').hide(500);       
},
error : function(XMLHttpRequest, textStatus, errorThrown) {
$('#waiting').hide(500);
$('#message').removeClass().addClass('error')
.text('There was an error.').show(500);
$('#loginForm').show(500);
}
});

            }


$this.addClass('clicked');
}
return false;
});
</code></pre>
