document.onclick = function() {
var elem = window.event.srcElement;
if (elem.className == "butt") {
var n1 = document.getElementById('n1').value,
n2 = document.getElementById('n2').value;
document.getElementById('n1').value = n2;
document.getElementById('n2').value = n1;
}
};
<input id="n1" value="1"><br>
<input id="n2" value="2"><br>
<button class="butt">Reverse</button>