Results 1 to 5 of 5

Thread: Javascript Tree Menu

  1. #1
    Join Date
    Feb 2009
    Posts
    55

    Javascript Tree Menu

    Everyone knows the tree menus, they are very practical, for example, when navigating on your own computer. Also on websites, they encounter a now and then. That this is not often the case, may have several reasons. Like they are hard to maintain, they usually only work with frames, the menu here treated as problems, etc. I need some suggestion on this. How get a tree menu of site in order to just determine the number of directories available. This will help to locate junk and get more information about the site.

  2. #2
    Join Date
    May 2008
    Posts
    2,297

    Re: Javascript Tree Menu

    The basic requirement to get a tree menu of your site by using JAVA script is some graphics in each and every case. This graphic includes the branches and icons of the menu which you can see. The picture you are using must have identical size. the scripting for the same can be done as mentioned below.
    HTML Code:
    <ul> <a href="index.htm"> home </ a> 
    <li> <a href="page1.htm"> Page 1 </ a> </ li> 
    <li> <a href="page2.htm"> Page 2 </ a> </ li> 
    <li> <a href="page3.htm"> Page 3 </ a> </ li> 
    <li> <a href="dir1.htm"> Directory Sub 1 </ a> 
    <ul> 
      <li> <a href="page1_1"> Page Sub1_1 </ a> </ li> 
      <li> <a href="page1_2"> Page Sub1_2 </ a> </ li> 
      <li> <a href="page1_3"> Page Sub1_3 </ a> </ li> 
    </ ul> 
    </ li> 
    </ ul>

  3. #3
    Join Date
    Oct 2005
    Posts
    2,393

    Re: Javascript Tree Menu

    The nesting can of course go much deeper. It should be noted, there can be no flow within the lists of text, all text, whether or link is located must be within HTML tags (except <li>). How to access the so-called "nodes" in the list. As nodes of any content of an HTML element is, even a line break, depending on the browser used to be regarded as a node. To clearly identify these nodes, you must have the text within an HTML element are, what is clearly identifiable as a node.

  4. #4
    Join Date
    May 2008
    Posts
    2,389

    Re: Javascript Tree Menu

    The first thing you will need to check whether the browser you use supports the property innerHTML. It must understand it, as this property is to be changed within the script. Furthermore, a basis for the functioning of the menu is the ability to change the display property of elements. To my knowledge, this is also possible only to browsers who know the innerHTML property. Here <li> all elements of the page, and check with the function in_menu (), whether they are inside of my menus.

  5. #5
    Join Date
    Feb 2008
    Posts
    1,852

    Re: Javascript Tree Menu

    The function is passes an element as an object. It is used to produced a new object with obj.parentNode, which is the parent node of this element and so the parent element. This will continue until it is the parent of the menu or the <body>. When it was identified as the parent of the menu, it can go. The code for the same will be like this :
    HTML Code:
    get_dimension function () 
         ( 
             intDimension =- 1; 
             objParentNode = objItem.parentNode; 
             while (objParentNode! = objMenu) 
                 ( 
                 if (objParentNode.tagName == 'UL') (intDimension + +;) 
                 objParentNode = objParentNode.parentNode; 
                 ) 
             intDimension return; 
         ) 

Similar Threads

  1. Replies: 3
    Last Post: 17-08-2012, 05:43 PM
  2. Creating Menu with DHTML or Javascript
    By Cade in forum Software Development
    Replies: 5
    Last Post: 11-01-2010, 06:55 PM
  3. JavaScript error: menu is not defined
    By ANSEL in forum Software Development
    Replies: 3
    Last Post: 20-10-2009, 06:41 PM
  4. Interner Explorer javascript menu error
    By Mozilla in forum Windows Software
    Replies: 3
    Last Post: 27-03-2009, 08:44 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,711,651,828.13232 seconds with 16 queries