мысли вслух -- не более 3 кликов за 5 сек
<!DOCTYPE HTML>
<html>
<head>
<title>Untitled</title>
</head>
<body> <input name="" type="button" value="test" onclick="game(this)">
<script>
var counter = 3,
time = 5000,
temp = [],
n = 0;
function game(obj) {
temp.push((new Date()).getTime());
var ok = limit(temp, time)
obj.style.backgroundColor = ok ? "lime" : "red"
n += +ok;
obj.value = n;
}
function limit(arr, time) {
var sum = 0;
for (var i = arr.length - 1, a, b; a = arr[i--];) {
b = arr[i];
b && (sum += (a - b));
sum > time && (arr.splice(0, i + 1))
};
var ok = sum > time || arr.length <= counter;
!ok && arr.pop();
return ok
}
</script>
</body>
</html>