[FX.php List] [OFF] A Javascript question
Karstyn McCoy
kmccoy at supportgroup.com
Wed Apr 22 17:12:33 MDT 2009
Hi Bob,
I'm no javascript expert, but have you tried eval? Something like this
alert( eval ('document.form1.' . WHICH . '.checked') );
'Which' may be a reserved word as well, can you change your var name to
something else?
--Karstyn
On Wed, Apr 22, 2009 at 3:55 PM, Bob Patin <bob at patin.com> wrote:
> I have a Javascript question:
>
> I have a table that builds rows, each of which with a checkbox.
>
> There are 2 checkbox rows that I want to monitor, and if they check either
> of them, show an alert to them.
>
> I know that when the page loads, the 2 checkboxes in question are going to
> get the NAMEs of "item3" and "item4", but I'd rather not have to hard-code
> my javascript function, in case we change the database and insert records
> that throw this all out of whack.
>
> So what I was hoping was to pass a variable to the function, the variable
> NAME (which for the two rows in question would be "item3" or "item4".
>
> No problem so far... I can do that easily enough.
>
> BUT...
>
> How do I construct this statement using the variable (whose name is WHICH):
>
> alert(document.form1.WHICH.checked);
>
> Is there a way to write that ALERT so that it will return the state of the
> checkbox that has been checked? The only way I've gotten it to work is to
> hard-code it like this:
>
> alert(document.form1.item3.check);
>
> But then what if my client inserts a record that now makes item3 become
> item4, and so on...
>
> Anyway, if anyone has any wisdom on this, I'd appreciate it; thanks,
>
> Bob Patin
>
>
>
>
>
> Longterm Solutions
> bob at longtermsolutions.com
> 615-333-6858
> http://www.longtermsolutions.com
> iChat: bobpatin
> AIM: longterm1954
> FileMaker 9 Certified Developer
> Member of FileMaker Business Alliance and FileMaker TechNet
> --------------------------
> FileMaker hosting and consulting for all versions of FileMaker
> PHP • Full email services • Free DNS hosting • Colocation • Consulting
>
>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.iviking.org/pipermail/fx.php_list/attachments/20090422/b84a7de2/attachment.html
More information about the FX.php_List
mailing list