Re: DOM/javascript experienced programmer needed for simple task

From: Date: Tue, 14 Jan 2003 18:34:03 +0000
Subject: Re: DOM/javascript experienced programmer needed for simple task
References: 1 2 3  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-12418@lists.php.net to get a copy of this message
is it possible to get a list of anchors in the div if you know the ID of the DIV? Otherwise, I will have to create an extended class to use the phpedit template. Major pain. Greg "Michael Dransfield" <mike@blueroot.net> wrote in message news:5.1.0.14.0.20030114152212.04ae96b0@212.67.194.181... > the anchors of a page are available through document.anchors, getting the > div that the anchor is in is difficult to do reliably. > > I would name the div's similar to the anchors like this > > <div id="appleDIV"> > <a name="appleANCHOR">Apples</a> > </div> > > <div id="pearDIV"> > <a name="pearANCHOR">Pears!</a> > </div> > > then with js, just remove the ANCHOR and add DIV to get the layer name... > > At 11:50 14/01/2003 +0100, Jan Schneider wrote: > >Zitat von Greg Beaver <greg@chiaraquartet.net>: > > > > > hi, > > > > > > We're using webfx.eae.net's tabpanes for the HTML:frames:phpedit template > > > in > > > phpDocumentor. Currently, if an anchor on an invisible tab is referenced > > > by > > > clicking an a href="doc.html#anchor" tag, the invisible tab will not > > > display. I don't know anything about DOM manipulation and would love it > > > if > > > someone with a bit of knowledge could tell me how to get a list of > > > anchors > > > in a div element cross-browser IE 5.5+ NS 6.0+ DOM-compatible, and from > > > there I'm fine because I can just retrieve the attribute once I've found > > > the > > > anchors. What I can't figure out is how to get the list, or the anchor > > > (and > > > how to tell which div it is in once I've found it). Selecting the tab > > > will > > > be easy, so the only stumbling block is finding which tab the anchor (a > > > name=) is on. > > > >getElementsByTagName() is what you are looking for: > >http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-core.html#ID-19 38918D > > > >It can be called on any object that implements the HTMLElement interface: > >var myDiv = document.getElementById('myDiv'); > >var myLinks = myDiv.getElementsByTagname('A'); > > > >Jan. > > > >-- > >http://www.horde.org - The Horde Project > >http://www.ammma.de - discover your knowledge > >http://www.tip4all.de - Deine private Tippgemeinschaft > > > >-- > >PEAR Development Mailing List (http://pear.php.net/) > >To unsubscribe, visit: http://www.php.net/unsub.php > >

« previous php.pear.dev (#12418) next »