I'm trying to make a javascript game which counts mouse click for ten seconds.
The problem is that the script ignores the onclick event somehow.Here is the code.
<html>
<head>
<script type="text/javascript">
var c=0;
var t;
var timer_is_on=0;
function timedCount()
{
document.getElementById('but').value=c;
c=c+1;
t=setTimeout("timedCount()",1000);
if (c>10)
{alert('over');
c=0;}
}
function doTimer()
{
if (!timer_is_on)
{
timer_is_on=1;
timedCount();
}
}
function broi()
{
var count=0;
document.getElementById('pole').value=count;
count=count+1;
}
document.onclick=broi;
</script>
</head>
<body>
<form>
<input type="button" value="Start" onclick="doTimer()">
<input type="text" id="but" />
<input type="text" id="pole" onmouseover="broi()" />
</form>
</body>
</html>