function next() {
var now = document.getElementById('counter').innerHTML;
if (isNaN(now) || now == '') {now = 0;}
now = Number(now);
now++;
document.getElementById('counter').innerHTML = now;
if (now == 100) {
alert("Еще немного кликов");
}
if (now == 10) {
}
}
<span onClick="next()" id="z"></span
<span id="counter"></span>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<button id="Nevelny1">Bled Nevelny</button>
<button id="Nevelny2">Bled Nevelny</button>
<script>
function bled(element) {
var clicks = 0;
return function(e) {
e.preventDefault();
if (++clicks == 10) {
element.style.backgroundColor = 'lime';
}
}
}
function setBledTo(element) {
element.onclick = bled(element);
}
setBledTo(document.getElementById('Nevelny1'));
setBledTo(document.getElementById('Nevelny2'));
</script>
</body>
</html>