<input type="button" value="Первая">
<input type="button" value="Вторая">
<input type="button" value="Третья">
<script>
var btns = document.querySelectorAll('input[type=button]');
for(var i = 0; i < btns.length; i++) {
btns[i].onclick = function(){
for(var j = 0; j < btns.length; j++) {
btns[j]==this? btns[j].style.color = 'red': btns[j].style.color = 'green';
}
}
}
</script>