Debes usar el evento onclick del botón y sumar los valores.
Por ejemplo:
Código PHP:
function fnCalc() {
a = parseInt(document.getElementById('a').value);
b = parseInt(document.getElementById('b').value);
alert(a+b);
}
Código HTML:
<input type='text' id='a'>
<input type='text' id='b'>
<input type='button' id='calc' value='Calcular' onclick='fnCalc()'>