Using Javascript
Using Javascript
Can we use javascript in tree menu. For example; i want to set onclick to the link..
It's possible!
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:
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
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);
//-->
I hope this helps. Could you please write your operating experience here?
Thanks for using TreeMenu.
Hans
Your forum admin
-
- Posts: 1
- Joined: 14 Mar 2008, 22:47
Re: Using Javascript
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
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