Hi,
Can anyone help me figure this out. I'm passing a String variable to a function that I want to use in the dot notation string to get the value of the input box.
EXAMPLE:
function calcext(price, boxname)
{
var exttotal = document.order.+'boxname'+.value * price;
document.order.extTot0.value = format(exttotal,2);
}
The "boxname" value/variable I'm passing into the function is a string and all I want to do is append it to the string reference of theinput box, like this.
document.order.+'boxname'+.value
I thought I could just append the value to the string but when I run the calculation it just returns NAN.
Ultimately all I need is to to get the value of an input box so I can calculate 2 numbers. But I can't hard code the dot notation string that references the input box I want to calculate.
Anyone able to help?
Mike
Mikecook@net-ins.com
Can anyone help me figure this out. I'm passing a String variable to a function that I want to use in the dot notation string to get the value of the input box.
EXAMPLE:
function calcext(price, boxname)
{
var exttotal = document.order.+'boxname'+.value * price;
document.order.extTot0.value = format(exttotal,2);
}
The "boxname" value/variable I'm passing into the function is a string and all I want to do is append it to the string reference of theinput box, like this.
document.order.+'boxname'+.value
I thought I could just append the value to the string but when I run the calculation it just returns NAN.
Ultimately all I need is to to get the value of an input box so I can calculate 2 numbers. But I can't hard code the dot notation string that references the input box I want to calculate.
Anyone able to help?
Mike
Mikecook@net-ins.com