As @Brandon said, the question is not entirely clear. As far as I understand, you are asking for something like this. I'm right? It is hard-coded, but I wanted to make sure I understood your question.
<script type="text/javascript"> var index = 0; function increment(var1) { index++; if(var1 == 1) { document.getElementById('button1').value=index; } else { document.getElementById('button2').value=index; } } </script> <input type="button" id="button1" onclick="increment(1)" value="increment me!"/> <input type="button" id="button2" onclick="increment(2)" value="increment me!"/>
source share