Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #19414

Re: javascript to test if anchor tag is contained within div tag

Newsgroups comp.lang.javascript
Date 2013-04-22 20:31 -0700
References <3191a789-89f0-4740-b9cc-77719dac2f60@googlegroups.com> <71e89685-4598-4b92-86d4-f01253a846f9@googlegroups.com> <85d30fa5-56d9-456a-9c48-67ce4b36bedf@googlegroups.com>
Message-ID <30b40f71-e1fa-40a9-a246-0dfb07ba3a2b@googlegroups.com> (permalink)
Subject Re: javascript to test if anchor tag is contained within div tag
From charles.e.finkenbiner@gmail.com

Show all headers | View raw


On Monday, April 22, 2013 7:34:00 PM UTC-5, charles.e....@gmail.com wrote:
> On Monday, April 22, 2013 3:22:21 PM UTC-5, Danny wrote:
> 
> > To Charles
> 
> > 
> 
> > 
> 
> > 
> 
> > Also keep in mind that 
> 
> > 
> 
> > 
> 
> > 
> 
> > <!ELEMENT UL - - (LI)+                 -- unordered list -->
> 
> > 
> 
> > 
> 
> > 
> 
> > UL/OL's only take LI's, not Div's, any div will need to be a child of an LI
> 
> 
> 
> To Danny,
> 
> 
> 
> Thanks for the link, I will check it out.  As for a DIV needing to be a child of an LI, I don't understand.  In my above HTML sample isn't the DIV a child of the Item2 LI?
> 
> 
> 
> Thanks for your help,
> 
> 
> 
> Charles
Hi All,

Well, what sounded easy is turning into a pain for me.  I have very basic HTML and javascript skills so please bear with me.

Based on my sample HTML code above anchor.parentNode.tagName only returns the element LI.  Also, since I am only looping the anchors I never seem to reach any DIV tag.

To Danny, I looked at your sample page but the problem for me is that the Item2-Sub# could be 3 levels deep or more in the future.  Your sample only seems to look up 1 level.

As an example:
I double click on Item2-Sub3 page.  This loads the browser with that page loaded in my display frame.  The menu frame is loaded with the correct menu item selected BUT it is hidden.  I have to click on Item2 to show/expand the 3 sub-levels.  When I show/expand Item2 the correct Item2-Sub3 menu item is selected, as it should.  Using anchor.parentNode.tagName at this point only returns the LI element.

So, does this mean I am not coding the HTML or javascript correctly?  Maybe a little example will help me.


Thanks for any help,

Charles

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

javascript to test if anchor tag is contained within div tag charles.e.finkenbiner@gmail.com - 2013-04-22 08:15 -0700
  Re: javascript to test if anchor tag is contained within div tag Danny <dann90038@gmail.com> - 2013-04-22 13:18 -0700
  Re: javascript to test if anchor tag is contained within div tag Danny <dann90038@gmail.com> - 2013-04-22 13:22 -0700
    Re: javascript to test if anchor tag is contained within div tag charles.e.finkenbiner@gmail.com - 2013-04-22 17:34 -0700
      Re: javascript to test if anchor tag is contained within div tag charles.e.finkenbiner@gmail.com - 2013-04-22 20:31 -0700
        Re: javascript to test if anchor tag is contained within div tag Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-04-23 10:07 +0200
  Re: javascript to test if anchor tag is contained within div tag Danny <dann90038@gmail.com> - 2013-04-23 11:50 -0700
  Re: javascript to test if anchor tag is contained within div tag CharlesEF <charles.e.finkenbiner@gmail.com> - 2013-04-24 01:51 -0700
    Re: javascript to test if anchor tag is contained within div tag Martin Leese <please@see.Web.for.e-mail.INVALID> - 2013-04-24 12:42 -0600
      Re: javascript to test if anchor tag is contained within div tag CharlesEF <charles.e.finkenbiner@gmail.com> - 2013-04-24 14:40 -0700

csiph-web