<html>
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<input type="text" id="i1" onchange="f()"><br>
<input type="text" id="i2" onchange="f()"><br>
<input type="text" id="i3" onchange="f()"><br>
<input type="text" id="i4" onchange="f()"><br>
<script>
function f(){
var n1=document.getElementById('i1').value;
var n2=document.getElementById('i2').value;
var n3=document.getElementById('i3').value;
var n4=document.getElementById('i4').value;
alert(Number(n1)+Number(n2)+Number(n3));
}
</script>
</body>
</html>
Так?