Back To Start Of Archive
Taken From The Forum: Help & Support for DHTML Menu Version 5+
Forum Topic: Click to view post
Last Updated: Saturday July 14 2012 - 06:07:16
Need to find item reference and its parent in the menu
Poster: akirk
Dated: Wednesday August 4 2004 - 19:36:19 BST
I am using iframes, and need to find the reference of the item selected in the menu, and its parent, so that i can highlight the top-level item while that page is being displayed. Does anyone know how to find these item references?
Thanks.
Poster: John
Dated: Wednesday August 4 2004 - 20:34:47 BST
Are you asking about menu:0,text:1,url:2, etc.? These can be seen in milonic_src.js.
Or this, or this?
Poster: akirk
Dated: Wednesday August 4 2004 - 20:41:47 BST
I found a solution to the highlighting problem in the FAQ's, called highlightme(), and it needs the item reference as the first thing in the method. I cannot figure out how to find this.
Here is the function:
function highlightme()
{
_i = _itemRef;
if ( _i==_W._lstI )
return;
_I = _mi[_i];
if ( _I.active && _i != _lstI )
{
_I[8] = _I.oCol;
_I[7] = _I.oBgCol;
}
else
{
_I.oCol = _I[8];
_I.oBgCol = _I[7];
if ( _I[19] )
_I[7] = _I[19];
if ( _I[18] )
_I[8] = _I[18];
_I.active = 1;
}
if ( !ns4 )
{
_lnk = gmobj( "lnk" + _i );
if ( _lnk )
_lnk.oC = _I[8];
}
if ( _W.lstI && _lstI != _i )
{
_I = _mi[_lstI];
_I[8] = _I.oCol;
_I[7] = _I.oBgCol;
if ( !ns4 )
{
_lnk = gmobj( "lnk" + _lstI );
if ( _lnk )
_lnk.oC = null;
}
gmobj( "el" + _lstI ).itemOn = 1;
_I.active = 0;
itemOff( _lstI );
}
itemOff( _i );
_lstI = _i;
}
Do you know how to find that value?
Thanks.
Poster: Ruth
Dated: Thursday August 5 2004 - 20:41:02 BST
Since I really don't know about functions, this may be wrong, but my reading of the FAQs is that the function you just listed IS the function as it's supposed to be written and that you just put it in the top of the menu_data.js file. At least that's what it seems to me to be saying. Then you use whichever way you want [it lists two that would be used in items themselves, and one that would be used in the particular menu style if it's for all items that use that style]. Don't take this as being the correct answer, because I don't do functions, but were I reading that faq and trying to implement it, I would just put it in as is.
Ruth
Poster: akirk
Dated: Thursday August 5 2004 - 20:57:22 BST
Thanks for the help. I thought the same thing, but my system was not recognizing the global variable _itemRef, or _W, or _lst1. I figured out my own way to set these values, and make it work.
Thanks again!
Poster: Ruth
Dated: Thursday August 5 2004 - 21:04:37 BST
You're welcome. If you could say how you set it, what OS and browser that might help someone else. It would greatly be appreciated.
Ruth
Poster: akirk
Dated: Friday August 6 2004 - 12:50:19 BST
Sure. I am using Windows XP Pro with an IE browser. I added a function that is called before highlightme() called setItemRef():
var _itemref;
var_lstI;
function setItemRef(iref)
{
_itemRef = iref;
}
I passed the menu position into this function (0 if it was the first menu item, 1 if it was the second menu item, etc.). then, I could use _itemref, and instead of using _W.lstI, I only used _lstI, which worked. Be careful with the last itemOff(_i) also. This was turning off my "0" position menu item after the second click. I got rid of that line, and it then worked perfectly.