Un ejemplo
Código HTML:
Ver original<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <script language="JavaScript" type="text/JavaScript"> function suma(){
var total=0;
for (var i=0;i<5;i++){
total+=parseFloat(document.getElementById("input"+i).value);
}
document.getElementById('divBase').innerHTML=total;
document.getElementById('divIVA').innerHTML=total*parseFloat(document.getElementById("tpiva").value)/100;
document.getElementById('divTotal').innerHTML=total*(1+parseFloat(document.getElementById("tpiva").value)/100);
}
<input name="input0" id="input0" type="text" value="0" onBlur="suma()"><br> <input name="input1" id="input1" type="text" value="0" onBlur="suma()"><br> <input name="input2" id="input2" type="text" value="0" onBlur="suma()"><br> <input name="input3" id="input3" type="text" value="0" onBlur="suma()"><br> <input name="input4" id="input4" type="text" value="0" onBlur="suma()"><br> TpIVA
<input name="tpiva" id="tpiva" type="text" value="21" onBlur="suma()"><br>