<html>
  <script>
	function cal(val1, val2,output){
		if(val1.value && val2.value)
			output.innerHTML = parseInt(val1.value,10) + parseInt(val2.value,10);
	}
	</script>
	<input id="v1" onChange="cal(this, document.getElementById('v2'),document.getElementById('div1'));"/>+
	<input id="v2" onChange="cal(document.getElementById('v1'),this,document.getElementById('div1'));"/>
	=<div id="div1"></div>
</html>