Recent Questions Frameset Javascript Tree Menu Example
Q: Is there a way we can add javascript behaviors to the popup menu in java actions? For example, is there a way we can add an onClick function to a popup menu in java item (eg, onClick="return MyFunction( )" ) so that we can catch and process key events?
I'm really hoping there's a way of doing this...
A: Unfortunately, you can't assign onmouseover/onClick/onContextMenu event to each item. However, you can achieve this by using standard html objects within popup menu in java items, for example:
var menuitems = [
["<div onContextMenu='your_code_here'>item text</div>", ""]
];
You can use your own Javascript code instead standard links. For example:
var menuItems = [
["text", "javascript:your_code_here"]
];
Q: The menu files need to be in EVERY directory that there is a page calling these files?
A: No you can use one folder with engine .js files.
But in your html pages you should write correctly your dmWorkPathparameter:
< script type="text/javascript"> var dmWorkPath = "./menudir/";</script>
and call dmenu.js file from the right place
<script type="text/javascript" src="./menudir/dmenu.js"> </script>
Q: After much coming and going I have finally got De Luxe menu to work with Firefox 2
But the menu system on the exact same htm page I have created does not show up in IE7.
Is this a known problem?
A: Try to set the exact width for the menu,
var menuWidth="700px";
Q: I'm trying to set the frame parameters to frame name body. I have tried seven different text items: body, _body, frame name=body, framename=body, "framename=body", the relative URL, and the exact URL in the titemTarget parameter (common parameters). Nothing seems to work. It always sets the target to a new window. What text do I need to enter for the default parameter to be the body frame target?
Also, is there a way to expand only the menus and not the submenus? There doesn't seem to be a halfway point. Either all the menus are open, or all closed. If I set the default to hidden, it is non-functional. If I set it to expanded, that's not what I'm looking for either.
The menu looks good; other than these two problems it is functioning properly.
A: Please, check the following parameter:
var titemTarget="framename";
You can also set item target for each item
["|Home","testlink.htm", "default.files/icon1_s.gif", "default.files/icon1_so.gif", "", "Home Page Tip", "framename", "", "", ],
Try that.
> Also, is there a way to expand only the menus and not the submenus?
You want to expand only the main items when you load your page?
If it is so you can set expanded items by default.
If you want to expand specific items by default you should set "+"symbol at the beginning of item text.
["+Javascript/DHTML Tree: XP Style","", "default.files/xpicon1_s.gif", "", "", "XP Title Tip", "", "0", "", ], // this item is expanded by default
["|Home","testlink.htm", "default.files/icon1_s.gif", "default.files/icon1_so.gif", "", "Home Page Tip", "framename", "", "", ],
["|Product Info","", "default.files/icon2_s.gif",
"default.files/icon2_so.gif", "", "Product Info Tip", "", "", "", ], // this subitem is not expanded by default