Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 07-11-2009
Member
 
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.
Reply With Quote
  #2  
Old 07-11-2009
Member
 
Join Date: May 2008
Posts: 2,293
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>
Reply With Quote
  #3  
Old 07-11-2009
Member
 
Join Date: Oct 2005
Posts: 2,389
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.
Reply With Quote
  #4  
Old 07-11-2009
Member
 
Join Date: May 2008
Posts: 2,383
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.
Reply With Quote
  #5  
Old 07-11-2009
Member
 
Join Date: Feb 2008
Posts: 1,848
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; 
     ) 
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Javascript Tree Menu"
Thread Thread Starter Forum Replies Last Post
Add or remove power user menu items in Windows 8 with Win+X Menu Editor Jhonny.Bravo Customize Desktop 3 17-08-2012 05:43 PM
Creating Menu with DHTML or Javascript Cade Software Development 5 11-01-2010 06:55 PM
JavaScript error: menu is not defined ANSEL Software Development 3 20-10-2009 06:41 PM
Interner Explorer javascript menu error Mozilla Windows Software 3 27-03-2009 08:44 AM


All times are GMT +5.5. The time now is 07:54 AM.