wrote:
> ... . The input text boxes that display my data are created
> dynamically.
Client-side or server-side?
> I'm creating these input boxes dynamically because the number
> of records for each company varies. The name of each input
> box increments by one for each record (Ex: A1, B1, C1 | A2,
> B2, C2, etc..)
>
> On my web page the user will enter in a number into the
> txtGrossPayroll(some number) input box. I have added an
> OnKeyDown="ComputePremium()" and an OnKeyUp="ComputePremium()"
Two calculations per key press?
> inside
> my input boxes. When the user begins to type in a number the
> following script runs and displays the premium inside the
> txtPremium(some number) input box.
>
>
> <script type="text/javascript" language="JavaScript">
> <!--
This "hide scripts form older browsers" stuff is superfluous.
> function ComputePremium() {
> document.ScheduleForm.txtPremium1.value =
> Math.round((document.ScheduleForm.txtRate1.value *
> (document.ScheduleForm.txtGrossPayroll1.value / 100)), 0);
^
What is the zero for?
> }
> // -->
> </script>
>
> Currently, I have the script so that it will only run for
> my 1st row of records.
Because you have hard-coded the form control name.
> Can the script be modified so that it is intelligent
> enough to know the correct input box name to use?
Yes.
> If so how?
By providing the row information as a parameter to the function call, in
some form, and then using bracket notation to reference the form
controls in the correct row.
> I'm not very familiar with JavaScripts; sorry if this
> is something that is very easy to do.
It is very easy to do, but how it is specifically done depends on the
HTML being scripted.
Richard.