<html>
<head>
<title>Space Clicker</title>
</head>
<body>
<script type="text/javascript">
int clicks = 0;
function click() {
clicks += 1;
document.getElementById("clicks").innerHTML = clicks;
};
</script>
<button type="button" onClick="click()">Click me</button>
<p>Clicks: <a id="clicks">0</a></p>
</body></html>
<html>
<body>
<div class = click>
<h1 id = "title">K'Jah's Button Clicker</h1>
<button type="button" id = "clicker">Click to count : 0 </button>
<button type="button" id = "reset">reset</button>
<h2>Click the button!</h2>
</div>
</body>
</html>
h1{
text-align: center;
color: blue;
}
h2{
color:blue
}
#clicker{
color:blue;
}
.click{
text-align: center
}
body{
background: pink
}
var button = document.getElementById('clicker'),
count = 0;
button.onclick = function() {
count += 1;
button.innerHTML = "click to count: " + count;
};
var reset =
document.getElementById('reset')
reset.onclick = function() {
count = 0;
button.innerHTML = "click to count: " + count;
};