Hi guyz....i am new here.... really appreciate if u can help me...
i am also a newbie in coding.....
i am trying to create a interface to average down variable amount of input and show them on screen as they type....
this is what i came up with.....
and the input box fields....these are dynamically created...
<input type="text" name="datup[0][4]" size="3" onchange="calc()" >
<input type="text" name="datup[1][4]" size="3" onchange="calc()" >
<input type="text" name="datup[2][4]" size="3" onchange="calc()" >
<input type="text" name="datup[3][4]" size="3" onchange="calc()" >
now the javascript function...this works with fixed variables
<script language="javascript">
function calc()
{
avcount= parseInt(document.getElementById('dtavge').value);
n1=parseFloat(document.getElementById('datup[0][4]').value);
n2=parseFloat(document.getElementById('datup[1][4]').value);
n3=parseFloat(document.getElementById('datup[2][4]').value);
n4=parseFloat(document.getElementById('datup[3][4]').value);
var totalc=((n1*1)+(n2*1)+(n3*1)+(n4*1))/avcount;
document.getElementById('bpover').value = totalc;
}
</script>
i need some help with the javascript code so it can dynamically adjust according to the count of input which i can provide(avcount variable)
plz do help...thx in advance.....