Using Javascript

Explorer like navigation tree for websites
Navigationsbaum für Internet Auftritte.
Post Reply
Guest

Using Javascript

Post by Guest »

Can we use javascript in tree menu. For example; i want to set onclick to the link.. :?:
User avatar
Hans
Site Admin
Posts: 77
Joined: 16 Dec 2005, 16:52
Location: Germany
Contact:

It's possible!

Post by Hans »

Hi,

sure it's possible. To call a javascript function from a menu-item you first must define the function and then refer to it. As an example you can code and refer to the function 'test()' in your menu-file (e.g. menu_eng.html) as described:

Code: Select all

<script type="text/javascript">
<!--
   function test() { alert("you are in your test function");  }
   ...
   tree = new treemenu('tree',...);
   ...
   tree.add(1,' Call function test', '','javascript:test()', '', '', '');
   ...
   document.write(tree);                                                                                              
//-->
You will have to leave the target empty and write 'javascript:test()' into the url to refer to the function test (see the help TreeMenu -> First steps -> Menu items). You should not explicitely use the event 'onclick', because this event already is used internally to call the routine 'pick()', which ist part of the treemenu.

I hope this helps. Could you please write your operating experience here?

Thanks for using TreeMenu.
Hans
Your forum admin
jsorg@sorgs.org
Posts: 1
Joined: 14 Mar 2008, 22:47

Re: Using Javascript

Post by jsorg@sorgs.org »

Hans said: "You will have to leave the target empty ..."

Aha, there's the missing bit !

We were struggling to make javascript links work in our TreeMenu implementation. Everything was looking grand, but a few links weren't working. We had improperly put target frames on them. We blanked them out and now they work.

Thanks for posting this.

Jack
Post Reply