Hi !

I'm playing around with this bit of javascript which totals up the value of three fields into a text box.

It seems to work fine but dreamweaver it telling me I should not have two values in the same text box.

Heres the code. Can someone tell me if it is ok


<form>
<input type="text" name="chProduct1" value="0" onFocus="calcTotal(this.form)" value="Total">
Product 1 - $5<br>
<input type="text" name="chProduct2" value="0" onFocus="calcTotal(this.form)" value="Total">
Product 2 - $50<br>
<input type="text" name="chProduct3" value="0" onFocus="calcTotal(this.form)" value="Total">
Product 3 - $500 <br>
Total <input type="text" name="Total" value="" onChange="calcTotal(this.form)"><br>
<br>
</form>

<script>
function calcTotal(frm){
frm.Total.value = 0;
for(i=0;i<frm.length;i++){
if(frm.elements[i].name.substr(0,2)=="ch"&&frm.elements[i]){
frm.Total.value = parseInt(frm.Total.value) + parseInt(frm.elements[i].value);
}
}
}
</script>


thanks