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 #321

Is there a way to trigger a specific link in the Tree Menu Magic 3 (TMM3) system remotely, by clicking a link somewhere else on the page?

The Answer

Prepared Oct. 2013 by Gerry Jacobsen, PVII

To open a specific menu item of the Tree Menu Magic 3 (TMM3) system by specifying the text of the link you can use this new script function:

1. Open the p7TM3scripts.js file and scroll to the end of the page. Add a new blank line and then copy and paste this new function into that new line:

function P7_TM3trigText(d,an){
  	var el,tA,a,pp;
    el=document.getElementById(d);
        if(el){
            tA=el.getElementsByTagName("A");
            for(i=0;i<tA.length;i++){
              if(an==tA[i].firstChild.nodeValue || an==tA[i].innerHTML) {
                pp=tA[i].parentNode;
                  while(pp){
                    if(pp.tagName&&pp.tagName=='LI'){
                      a=pp.getElementsByTagName('A');
                      if(a&&a[0]){
                        if(a[0].tm3Sub){
                          P7_TM3open(a[0],1);
                        }
                      }
                    }else{
                      if(pp==el){
                        break;
                      }
                    }
                  pp=pp.parentNode;
               }
            }
       }
   }
}

2. Save and close the file.

3. You would assign a function call (behavior) to any normal link on your page, like this:

<a href="#" onclick="P7_TM3trigText('p7TM3_1','MyLink');return false">Open to MyLink</a>

The first argument is the ID of the TMM3 system that the link appears in ( 'p7TM3_1' ) and the second argument is the text that appears in the menu link you wish to open.

Back to the questions list