var boton = document.getElementById("s"), a = document.getElementById("a"), b = document.getElementById("b"), c = document.getElementById("c"); s.addEventListener("click", function(){ if (!isNaN(b.value)) c.value = Number(a.value) + Number(b.value); }, false);
Cantidad 1: <input type = "text" id = "a" value = 5 readOnly /> Cantidad 2: <input type = "text" id = "b" autofocus /> Resultado: <input type = "text" id = "c" readOnly /> <button id = "s">Sumar</button>