Disclaimer: I'm used to Visual Basic. And for some reason I'm having a hard time making JavaScript do what I want. Bleah So please please don't think I'm a total idiot, I'm just new at this...

Anyway, I'm trying to do calculations with JS. Actually, the script already works, but I had to kludge it together, and I would rather use variables to make it streamlined and pretty.

The thing I'm doing is at http://www.informationsavant.com/gui...enerator.shtml

What I'm doing is taking the values of three text boxes in a form and, onChange, multiplying them to set the value of a 4th text box. And there are 24 lines like this altogether, like in a spreadsheet. At the moment I have 24 separate functions for doing this, so this is where I'd like to use variables.

This is example code from one of the changeable text boxes that calls the function:
<input type="text" name="item01" value="0" size="3" onChange="subtotal01(this.form)")">

and here is the function:
function subtotal01 (form) {
form.subtotal01text.value = form.item01.value * form.time01.value * form.rate01.value;
}

When I tried changing the function so that it would take all 4 values in the form of variables, like this:
function funcSubtotal (form, item, rate, time, subtotal) {
form.subtotal.value = form.item.value * form.time.value * form.rate.value;
}

and the call to the function changed to:
<input...etc...onChange="funcSubtotal(this.form, item01, time01, rate01, subtotal01")

the error I got would tell me that "subtotal is null or not valid" (I think that was it, I'm doing this from memory).

OK, that was long-winded enough...does anyone have any bright ideas? Thanks much...