index.html:
Code: Select all
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="script.js"></script>
</head>
<body>
<center><h1>How many times are you willing to click the button?</h1>
<p><span id="number">0</span></p>
<br />
<a href="" onclick="javascript:linkClicked();">Click here</a></center>
</body>
</html>script.js
Code: Select all
//vars
var timesClicked = 0;
function linkClicked(){
timesClicked++;
document.getElementById("number").innerHTML = timesClicked;
}