HTML:
<input type="button" value="+1" onclick="addNum()" />
<span id="add_num">0</span>
javascript
:
var elem = document.getElementById('add_num'), num = +elem.innerHTML;
function addNum()
{
elem.innerHTML = num++;
if(num == 10)
{
alert('Вы досчитали до 10!');
num = -1;
}
}