On 5 Nov 98, Jack Killpatrick wrote:
> Ideally, this would set thing_1_deluxe so that the word "joey" showed up
> in it. Thing is, I'm not sure how to embed the variable in the string that
> identifies the form.element.value.
>
> Anyone have any ideas? I've tried doing some concat's, but haven't hit
on
> anything that works yet.
Here's a snippet of code from Goodman's Javascript Bible, which, while not
exactly the same as what you're trying to do, does make use of a variable
form name. (Rather, it's part of a routine to calculate the total price of a
list of items in a catalog/online store.) It may give you something to work
with...
First, code to automatically generate an array of text inputs named
"Qty1", "Qty2", etc:
for (var i = 0; i <= 10; i++) {
...
document.write(�<INPUT TYPE=�text� NAME=�Qty� + i + ��>�)
...
...then to actually address the various text inputs:
for (var i = 0; i < Qty.length; i++) {
var rowSum = form[�Qty� + i].value * form[�Price� + i].value
form[�Total� + i].value = formatNum(rowSum,2)
In these examples, 'i' is just a variable like any other, even if in this case it
being used for incremental counting. The general syntax should apply in
other cases though, AFAIK.
-----------
Brent Eades, Almonte, Ontario
E-mail: [EMAIL PROTECTED]
[EMAIL PROTECTED]
Town of Almonte site: http://www.almonte.com/
Business site: http://www.federalweb.com
____________________________________________________________________
--------------------------------------------------------------------
Join The Web Consultants Association : Register on our web site Now
Web Consultants Web Site : http://just4u.com/webconsultants
If you lose the instructions All subscription/unsubscribing can be done
directly from our website for all our lists.
---------------------------------------------------------------------