thanks guys, that makes sense.  I hacked around w/ it and found that
the issue I'm running into was based on 2 things:
1. I'm selecting "gallery" as a class instead of an id (syntax error)
2. I'm running into an issue w/ IE in which I can't overwrite the
onClick attribute.

#2 isn't shown in this example.  ...long story as to why I need to do
this and I'm not sure it's possible really.  ...will start a new
thread.

Thanks Again!

On Mar 23, 7:51 am, Richard Quadling <rquadl...@googlemail.com> wrote:
> 2009/3/21 T.J. Crowder <t...@crowdersoftware.com>:
>
>
>
>
>
> > Hi,
>
> >> hmm, well, links[0] is returning a string, not the a object...
>
> > No, it isn't.  Richard already answered your question:  Your alert
> > coerces the object into a string, which implicitly calls the toString
> >methodon it, which (in the case of a link)returnsthehref.  If you
> > actually _try_ what he suggested, you'll see that he's right.
>
> > Here's a page demonstrating this stuff:
> >http://pastie.org/422726
>
> > If you run that in a browser, the output is:
> > * * * *
> > links.length = 4
> > typeof links[0] = object
> > links[0].id = one
> > links[0].href=http://prototypejs.org/api
> > links[0].innerHTML = Prototype API
> > links[0] dumped via implicit call to toString:http://prototypejs.org/api
> > -------------
> > The full array:
> > Link "one" ("Prototype API") links tohttp://prototypejs.org/api
> > Link "two" ("Google (U.S.)") links tohttp://www.google.com/
> > Link "four" ("Example") links tohttp://example.com/
> > Link "five" ("BBC News") links tohttp://news.bbc.co.uk/
> > * * * *
>
> > HTH,
> > --
> > T.J. Crowder
> > tj / crowder software / com
> > Independent Software Engineer, consulting services available
>
> > On Mar 20, 5:01 pm, tkane2000 <tkthomp...@gmail.com> wrote:
> >> hmm, well, links[0] is returning a string, not the a object, so those
> >> will both return null.
>
> >> The question is why does this statement:
> >> $$('.gallery .thumb .listItem .thumbHolder');
> >> return thevalueofhref(a string) and not that a object?
>
> >> Thanks!
>
> >> On Mar 20, 6:38 am, Richard Quadling <rquadl...@googlemail.com> wrote:
>
> >> > Almost certainly you are seeing the results of a toString()method
> >> > kicking in for the objects (or similar).
>
> >> > Try ...
>
> >> > alert("links[0]:" + links[0].id + ':' + links[0].href);
>
> >> > Richard Quadling.
>
> >> > 2009/3/20 tkane2000 <tkthomp...@gmail.com>:
>
> >> > > How come the $$() functionreturnsthevalueof thehrefwhen
> >> > > selecting ananchortaginsteadof thetagitself?  ...I've had mixed
> >> > > results for this btwn FF and IE6, but it's consistant in the code
> >> > > below.  Anyone know what I'm doing wrong here or if there's a
> >> > > workaround?
>
> >> > > <div id="gallery">
> >> > >        <div class="thumb">
> >> > >                <div class="listItem">
> >> > >                        <ahref="/asdfasdf/asdfsdf.jhtml" 
> >> > > class="thumbHolder">this is some
> >> > > text</a><br />
> >> > >                        <ahref="/asdfasdf/asdfsdf.jhtml" 
> >> > > class="thumbHolder">this is some
> >> > > text</a><br />
> >> > >                </div>
> >> > >        </div><br />
> >> > >        <div class="thumb">
> >> > >                <div class="listItem">
> >> > >                        <ahref="/asdfasdf/234234.jhtml" 
> >> > > class="thumbHolder">this is some
> >> > > text 21</a><br />
> >> > >                        <ahref="/asdfasdf/234234.jhtml" 
> >> > > class="thumbHolder">this is some
> >> > > text 23</a><br />
> >> > >                </div>
> >> > >        </div>
> >> > > </div>
>
> >> > > <script type="text/javascript">
> >> > >        var links = $$('.gallery .thumb .listItem .thumbHolder');
> >> > >        alert("links[0]:" + links[0]);
> >> > > </script>
>
> >> > --
> >> > -----
> >> > Richard Quadling
> >> > Zend Certified Engineer :http://zend.com/zce.php?c=ZEND002498&r=213474731
> >> > "Standing on the shoulders of some very clever giants!"
>
> Thanks TJ. Still learning. PHP is my bag. Prototype is very much being
> added to it though.
>
> --
> -----
> Richard Quadling
> Zend Certified Engineer :http://zend.com/zce.php?c=ZEND002498&r=213474731
> "Standing on the shoulders of some very clever giants!"
--~--~---------~--~----~------------~-------~--~----~
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