Scroll To Top

Enter a query to search our site. Note that you can use "*" and "?" as wildcards. Enclosing more than one word in double quotes ("CSS Layout") will search for the exact phrase.

PVII Knowledge Base

1. Select a product ...
2. Select category ...
3. Search the Knowledge Base...

Question #118

In TreeMenu Magic is there a way to automatically have the appropriate menu section open by declaring the actual text that appears in the link?

The Answer

Prepared Nov. 2003 by Gerry Jacobsen, PVII

Note: This functionality is included and fully automated in the more recent Tree Menu Magic 2 system, which contains a complete Advanced Current Marking interface.

You can use this special JavaScript function on the page instead of the normal "P7_TMopen(): function on the <body> tag, onLoad event.

Revised Mar. 31, 2004

Here's the function:

function P7_TMopenLink(mrk,theLink){ //v1.2a by Project Seven Development(PVII)
var i,x,d,hr,ha,ef,a,ag;if(document.getElementById){

Here's how it works:

1. Copy and paste this new JavaScript function, P7_TMopenLink(), into your p7tmscript.js file. Save the file.

2. In the existing <body> tag, onLoad event:

Change this:

<body onLoad="P7_TMopen()">

to this:

<body onLoad="P7_TMopenLink(0,'My Link Text')">

where the 'My Link Text' is the actual text that appears on the link that you wish to open. The text should always be wrapped by a pair of single quotes ('). For example, the above will open the menu to the menu link that looks like this:

<a href="my_test_page.htm" onClick="P7_TMenu(this);return false">My Link Text</a>

3. Options - The first argument, 0 or 1, allows you to specify whether to have the link marked with the "currentmark":

0 - Does not set the currentmark class for the link.

1 -Sets the "currentmark" className for the link.


Note 1: If you are using the "text trigger" option, the plus sign (+) will be a part of the actual text link. Be sure to include this in the argument, like:

<body onLoad="P7_TMopenLink(0,'+ My Link Text')">

Note 2: This technique will work for any link or trigger in the menu, that is, you can use this to simply open a menu section without highlighting an actual page link inside that menu section; just use the actual text of the trigger link.

That's It!

Back to the questions list