Or output class="some-class" in the element tags and observe the whole set
with some event delegation... will keep your markup and JS sep. and clean.



On Fri, Jul 24, 2009 at 7:59 PM, T.J. Crowder <t...@crowdersoftware.com>wrote:

>
> Hi,
>
> > echo "<h2><a href=\"#\" onclick=\"Effect.toggle('d2','BLIND',
> > {duration: 2.0}); return false;\">$directory</h2><br /></a>";
>
> I'm not a PHP guy, but surely that ends up outputting HTML that has an
> onclick attribute calling Effect.toggle on the literal element ID
> "d2"?  And of course, IDs are unique in a page, so that's only ever
> going to affect one element.
>
> If you want to affect other elements, you'll have to give them unique
> IDs and make the call use those IDs appropriately.
>
> FWIW,
> --
> T.J. Crowder
> tj / crowder software / com
> Independent Software Engineer, consulting services available
>
>
> On Jul 24, 7:27 pm, dmcglone <d.mcgl...@att.net> wrote:
> > Hi all,
> >
> >  I am trying to create a page that reads a directory of images and
> > displays them with scriptaculous. So far from what I have, the code
> > does work as far as displaying the directory links but it is only
> > making the very 1st one active, all the rest of the directory links on
> > the page work, BUT they are expanding and folding only the first
> > directory (gemstone).
> >
> > I hope this was a good explanation. I've posted my code to help make
> > it as clear as I can.
> >
> > Here is my code:
> >
> > <?php
> > echo "<div id = noWrap>";
> > echo '<div id = img_cursor>';
> >
> > $directories = array('gemstone', 'bella', 'passage', 'sedona',
> > 'deepstar', 'crystalline');
> >
> > foreach ($directories as $directory){
> >
> > $mydir2=opendir("images/laminate/Wilsonart_Laminate_Colors/
> > $directory");
> >
> > $cats2=array();
> >
> > echo "<h2><a href=\"#\" onclick=\"Effect.toggle('d2','BLIND',
> > {duration: 2.0}); return false;\">$directory</h2><br /></a>";
> >
> > while(($cat2=readdir($mydir2)) !==false){
> >
> > if ($cat2 != "." && $cat2 != ".." && strpos(strtolower($cat2),"-
> > thumb.jpg") !== false){
> > array_push($cats2, $cat2);
> >
> > echo "<div id=\"d2\" style=\"display:none;\">";
> >
> > echo "<img src='images/laminate/Wilsonart_Laminate_Colors/$directory/
> > $cat2' onclick='Another_Big_One(this)'></div>";
> >
> > }
> > }
> >
> > closedir($mydir2);
> >
> > }
> >
> > echo "</div>";
> > echo "</div>";
> >
> > ?>
> >
> > Blessings
> > David M.
> >
>

--~--~---------~--~----~------------~-------~--~----~
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 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to