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.
Need to find item reference and its parent in the menu
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.
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.
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
Ruth
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.
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.