<input id="whatButton">
<button id="button1" onclick="inputEdit(this.id)">1</button>
<button id="button2" onclick="inputEdit(this.id)">2</button>
<button id="button3" onclick="inputEdit(this.id)">3</button>
function inputEdit(id) {
document.getElementById("whatButton").value = id;
}