PDA

View Full Version : retrieve textbox value calc then display in different tb. url inc. for clarification


scoobs
09-09-2002, 02:21 AM
Hi and thankyou for looking

Problem:

There are 53 qty values and prices (both r tb's). I want to retrieve qty1 calculate it then display it in the price tb using 2 main lines.
quantity = document.quote.QTY(i).value; - this to retrieve
document.quote.PRICE(i).value = ("$ ") + display; - this to paste

These 2 lines are giving me the touble, each tb is named qty1 to qty53, same for price. Which is why i am sure i can use the (i) to point to each qty(i) name to retrieve the value.

url:

to get a clear picture of exactly what i am talking about, site and code is found at http://home.iprimus.com.au/chemrex

Code:

function calculate(){
var quantity = 0;
var price = 0;
var display = 0;
for (i = 1; i <= 53; qty++){
quantity = document.quote.QTY(i).value; //error, this line
if (quantity == ""){
}
else if((quantity < 10000) && (quantity > 0)){
price = ((1.58 * quantity) / 3);
display = round(price,2);
document.quote.PRICE(i).value = ("$ ") + display;
total = total + display;
}
else {
alert("Please enter a whole numeric value");
document.quote.QTY(i).focus();
}
}

You can see what i am trying to do, i just need some suggestions on how i should attack this problem.