On Nov 3, 11:12 am, ColinFine <[EMAIL PROTECTED]> wrote:
> There is something very confusing about what you have said. In your
> text you say "I can only pass the ID of the element through a
> function", in the code you refer to "span_1" etc as the 'spanName',
> but then it is actually a class name. Is it really an ID, a name, or a
> class?
> You only exhibit a single span with each class name 'span_1' etc. so
> I'm guessing that you have several spans with class 'span_1', several
> with 'span_2' etc. Is that the case?
>
> If so, what I think you want is
>
> if $$('span'+level_ID).all(function(span) {return
> span.hasClassName('complete');}) { ...
>
> On the other hand, if you have only one 'span_1', only one 'span_2',
> then I don't understand why you are using these separate classnames,
> as they are effectively duplicating the id's. In this case, I would
> recommend you give them all a single class (say 'myspan'), and then
> write
>
> if $$('myspan').all(function(span) {return
> span.hasClassName('complete');}) { ...
>
> Colin

Thank you Colin. In the interests of simplicity I'm trying to keep the
full code away from this post, it'll only make things more complex.
Basically, I'm working on a three-tier menu system. You can enable/
disable a menu option, and if all of the child items of a menu item
are enabled, then the parent becomes enabled. The reason I have all
the span_1, span_2 etc is because there are about 50 potential child
elements. Consider:

Option 1 ------> Option 2a
                 Option 2b -------> Option 3a
                 Option 2c          Option 3b

Option 2 ------> Option 2d -------> Option 3c
                 Option 2e          Option 3d
                                    Option 3e

I want to make it so when I enable option 3a and 3b, option 2b changes
to 'complete'. This is why those classnames have to be unique - they
could easily be IDs instead, but I still have the same issue. Each
collection of options is contained within a <div> whose ID is
dynamically generated, so I only want to test for <span>s within that
particular <div>. Do you follow now?

Matt
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to