I'm working on a perl to javascript program now that pulls in stuff from SQL
server. When I want to change a variable in lotusscript as you are attempting
I found this to work:
first initialize a variable, then assign a string to it, finally evaluate it,
as in this perl segment:
...
print " var setcolor = \"\";\n";
print " setcolor =
setcolor.concat(document.layers[\"top\"].document.layers[\"values\"].document.layers[\"element_'
+ j + '\"].bgColor=\"black\";')\n";
print " eval(setcolor)\n";
where "j" is the outside variable.
Hope this helps...
Larry
Jack Killpatrick wrote:
> For Javascript heads:
>
> Anyone know what the syntax is to place a variable into the name of a form
> element so I can then set it's value?
>
> For example, I have form elements who's names are generated on the fly from
> a db:
>
> <input type="text" name="thing_1_deluxe" value="">
> <input type="text" name="thing_2_deluxe" value="">
> <input type="text" name="thing_3_deluxe" value="">
>
> The number between the _'s is inserted by the db.
>
> My javascript function call has the number as a parameter:
>
> function copy_business_address(number){
>
> I want to change the text in the text input element by setting the value on
> the correct "numbered" form element in my javascript. In perl I could just
> embed the variable name and be done with it. For example, in Perl, let's
> say
> the variable is $number. I would identify the form field by doing this:
>
> thing_$number_deluxe
>
> If $number was 1, I'd get:
>
> thing_1_deluxe
>
> which is what I'm shooting for in my javascript:
>
> function copy_business_address(address_type_ID){
> form.thing_number_deluxe.value = "joey";
> }
>
> 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.
>
> Thanks much,
> Jack
>
> ____________________________________________________________________
> --------------------------------------------------------------------
> 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.
> ---------------------------------------------------------------------
____________________________________________________________________
--------------------------------------------------------------------
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.
---------------------------------------------------------------------