TreeMenu Magic -Open Section Link Modification

This is the second page -the Menu Section One link should be in its open state.

There are occasions when you would like to have a Menu Section item also link to another page, perhaps an intro page for that section.

The Menu Section One link on this page has been activated to load a new page whenever the link is clicked. When the new page is loaded, Menu Section One will automatically expand to show its submenu.

Here's a code tweak that enhances the functionality of the automatic opener to include the menu section links as well:

How to...

1. First, activate the menu section link. Supply an actual hyperlink to load the desired page, this will take the place of the default hash (#). The link will now look like this:

<div><a href="open_tmm_section_one.htm" onClick="P7_TMenu(this);return false">Menu Section One</a>

2. We will also need to remove the ";return false" from the onClick event of the link, otherwise nothing will happen :-) The link should now look like this:

<div><a href="open_tmm_section_one.htm" onClick="P7_TMenu(this)">Menu Section One</a>

3. Next, we'll make a code tweak to the P7_TMopen() function:

-Look for the 4th line in the script, it will look like this:

ha[i].className="p7currentmark";a=ha[i].parentNode.parentNode;while(a){

-Replace this entire line with these two lines:

if(ha[i].onclick&&ha[i].onclick.toString().indexOf("P7_TMenu")>-1){a=ha[i].parentNode;
}else{ha[i].className="p7currentmark";a=ha[i].parentNode.parentNode;}while(a){

-Be sure that this is on exactly two lines.

-Save and close the file.

 

That's It!

Now the menu will automatically open to any menu section or menu link item that corresponds to the page being loaded.

Tree Menu Magic by PVII
imagine the possibilities