Click to See Complete Forum and Search --> : I need some help- I am new at Javascript


hba937
11-11-2003, 09:07 PM
I am confused why the attached order form will not perform the calculations. I am new to Javascript and am struggling with it. I hope someone can help me!

Thanks,
hba937

skriptor
11-12-2003, 03:35 AM
Hi,
two things:
1.
Added '.value'

function sub_price(pricename, qtyname, subname) {
pricevalue=eval(document.order.elements[pricename].value);
qtyvalue=eval(document.order.elements[qtyname].value);
document.order.elements[subname].value = dollars(pricevalue * qtyvalue);
tax_price(subname);
total_price();
}

2.
Event is onblur

<td><input class="quantity" name="qty1" size="7" onblur="sub_price('price1', 'qty1', 'sub1')"></td>


Good luck, skriptor

hba937
11-12-2003, 05:57 PM
That fixed it! Thank you so much!! I have been driving myself crazy trying to get it to work with obviously no success. Again, thank you!!!!