and you're using some sort of index thing because you want to keep adding additional fields ...
function updateSubtotal(e) {
var evn = e.name
var evv = e.value
var indx = evn.substr(evn.length -1);
var st=document.getElementsByName("subtotal"+indx)[0];
var qt=document.getElementsByName("fielda"+indx)[0].value;
var ct=document.getElementsByName("fieldb"+indx)[0].value;
st.value=qt*ct
}
so if you have a field1 and field2 you can multiply it together... and it will apply for the current index level that is applied to the named field.
so ... fielda100 will multiply to fieldb100 and update subtotal100
then you'd put onBlur=updateSubtotal(this) in fielda and fieldb
No comments:
Post a Comment