Hello all, I would like help with JavaScript. I am making "game" in style like Click Challange on facebook. Or for those who don't use facebook, it is "game" Where you click one button and for each click you get 1 point. You have 10 seconds to do it. So players compete who will get more clicks in 10 seconds.
Anyway: I made button and you get 1 point for each. But i can't set timer... I am "beginner" in JavaScript....
Here is the script:
<head>
<title>Doom's clicking mania</title>
<link rel="stylesheet" type="text/css" href="style.css"></link>
<meta http-equiv="generator" content="CoffeeCup HTML Editor ( />
<meta name="created" content="sub, 07 kol 2010 22:04:54 GMT" />
<meta http-equiv="content-type" content="text/html;charset=windows-1250" />
<meta name="description" content="" />
<meta name="keywords" content="" />
<script type="text/javascript">
/* Doom's click mania
Creditsoom(Dino Aljeviæ) for HTML and JavaScript coding
Lolman(Sanjin Kalanj) for idea of this "game"
*/
var c=0;
function clickIt()
{
c++;
document.getElementById('score').value=c;
if(c>=100)
{
alert("You have reached 100 or above clicks before timer expired! You are Champinon!");
}
}
</script>
<title>Timer</title>
</head>
<body>
<form>
<input type="button" onClick="clickIt()" value="Click it"></input>
<input type="text" id="score" size="20"></input>
</form>
Doom's clicking mania 1.0
<br />Credits:
<br />Doom(Dino Aljeviæ) for HTML and JavaScript coding
<br />Lolman(Sanjin Kalanj) for idea
</body>
</html>
If you can help me make script that set timer to 10 seconds and when timer finish you get something like 'alert("You reached " + c + "clicks");'
Anyway: I made button and you get 1 point for each. But i can't set timer... I am "beginner" in JavaScript....
Here is the script:
<head>
<title>Doom's clicking mania</title>
<link rel="stylesheet" type="text/css" href="style.css"></link>
<meta http-equiv="generator" content="CoffeeCup HTML Editor ( />
<meta name="created" content="sub, 07 kol 2010 22:04:54 GMT" />
<meta http-equiv="content-type" content="text/html;charset=windows-1250" />
<meta name="description" content="" />
<meta name="keywords" content="" />
<script type="text/javascript">
/* Doom's click mania
Creditsoom(Dino Aljeviæ) for HTML and JavaScript coding
Lolman(Sanjin Kalanj) for idea of this "game"
*/
var c=0;
function clickIt()
{
c++;
document.getElementById('score').value=c;
if(c>=100)
{
alert("You have reached 100 or above clicks before timer expired! You are Champinon!");
}
}
</script>
<title>Timer</title>
</head>
<body>
<form>
<input type="button" onClick="clickIt()" value="Click it"></input>
<input type="text" id="score" size="20"></input>
</form>
Doom's clicking mania 1.0
<br />Credits:
<br />Doom(Dino Aljeviæ) for HTML and JavaScript coding
<br />Lolman(Sanjin Kalanj) for idea
</body>
</html>
If you can help me make script that set timer to 10 seconds and when timer finish you get something like 'alert("You reached " + c + "clicks");'