Javascript : What's wrong with this script?

privt

New Member
I've successfully used this calculate script on one of my page, however, when I reused it in the other one. That page keep saying "Uncaught TypeError: Cannot read property 'value' of undefined " I don't understand what's wrong with this script. So could you please help me. Thank you.\[code\]<script>function startCalc(){ //automatically calculate total after discount when adding new order interval = setInterval("calc()",1);}function calc(){ // for calculate each product order var price; var qty; var od_total; price = document.myform.od_price.value; qty = document.myform.od_qty.value; od_total = (price * 1) * (qty * 1); document.myform.od_total.value = http://stackoverflow.com/questions/12141516/od_total.toFixed(2); }function stopCalc(){ clearInterval(interval);}</script>\[/code\]I used this script with \[code\]<input id="od_qty" name="od_qty" type="text" size="8" value="" maxlength="100" onFocus="startCalc();" onBlur="stopCalc();"><input id="od_price" type="text" size="4" value="http://stackoverflow.com/questions/12141516/<%=rs.fields.item("cust_price")%>" onFocus="startCalc();" onBlur="stopCalc();" ><input id="od_total" name="od_total" type="text" size="10" value="" maxlength="100" readonly="true">\[/code\]
 
Back
Top