Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

js rollover menu help

Status
Not open for further replies.

kneebar

Programmer
Apr 30, 2002
7
US
I have a javascript rollover menu that is beinf generate dynamically but I have trouble having the rollover portion of the menu "roll out" (i mean roll out of site - disappear) when the cursor is nowhere near the target. could someone look at this snippet of code and let me know what i am doing wrong? what sort of funtion do i need and where can i put it? thanks for any help I really appreciate it!

//==================================================

for (z=0; z< subitemcount; z++) {

menu.document.writeln(&quot;<table ID=&quot; + subitems[z] + &quot; border=\&quot;1\&quot; STYLE='position:absolute; top:30px; left:0px; visibility:hidden'>&quot;);
menu.document.writeln(&quot;<tr>&quot;);

targetNumber = subitems[z];
targetNumberArray = targetNumber.split(&quot;.&quot;);
targetLevel = targetNumberArray.length-1;

for (i=1; i<tocTab.length; i++) {

thisNumber = tocTab[0];
thisNumArray = thisNumber.split(&quot;.&quot;);
thisLevel = thisNumArray.length-1;



isOnPath = true;
for (j=0; j<=targetLevel; j++) {
isOnPath = isOnPath && (thisNumArray[j] == targetNumberArray[j]);
}


menuDisplay = isOnPath && ((targetLevel+1) == thisLevel);

} // End of loop over the tocTab

var scrollY=0, addScroll=tocScroll;
for (i=1; i<tocTab.length; i++) {
if (menuDisplay) {
thisNumber = tocTab[0];
thisNumArray = thisNumber.split(&quot;.&quot;);
thisLevel = thisNumArray.length-1;
isCurrent = (i == currentIndex);

// If the scoll parameter is set true than increment the scrollY value:
if (addScroll) scrollY+=((thisLevel<2)?mdi:sml)*25;
if (isCurrent) addScroll=false;

// thisTextColor = the text color of this heading
if (noLink)
thisTextColor = (thisNumber==oldCurrentNumber) ? currentColor:((thisNumber==oldLastVisitNumber) ? lastVisitColor:normalColor);
else thisTextColor = (thisNumber==currentNumber) ? currentColor:((thisNumber==oldCurrentNumber) ? lastVisitColor:normalColor);


// ...then the hading symbol and the heading text each with a javaScript link caling just this function reDisplay again:
menu.document.writeln(&quot;<td>&quot;);
menu.document.writeln(&quot;<a href=\&quot;javaScript:history.go(0)\&quot; onMouseOver=\&quot;parent.displaySubMenu('&quot; + thisNumber + &quot;');\&quot; onMouseDown=\&quot;parent.reDisplay('&quot; + thisNumber + &quot;',&quot; + &quot;1&quot; + &quot;,&quot; + tocLinks[1] + &quot;,event)\&quot; style=\&quot;font-family: &quot; + fontLines + &quot;; alert();&quot; + ((thisLevel<=mLevel)?&quot;font-weight:bold&quot;:&quot;&quot;) + &quot;; font-size:&quot; + ((thisLevel<=mLevel)?mdi:sml) + &quot;em; color: &quot; + thisTextColor + &quot;; text-decoration:none\&quot;>&quot; + tocTab[1] + &quot;</a>&quot;);
menu.document.writeln(&quot;</td>&quot;);
}
} // End of loop over the tocTab

}


menu.document.writeln(&quot;</tr>&quot;);
menu.document.writeln(&quot;</table>&quot;);

//==============================================
menu.document.writeln(&quot;</body></html>&quot;);
menu.document.close();

// ***************************************
// Closing the ToC document, scrolling its frame window and displaying new content in the content frame or in the top window if required
// ***************************************

// Updating the global variables oldCurrentNumber and oldLastVisitNumber. See above for its definition
if (!noLink) {
oldLastVisitNumber = oldCurrentNumber;
oldCurrentNumber = currentNumber;
}

// Scrolling the ToC if required
if (tocScroll) toc.scroll(0,scrollY);

// Setting the top or content window's location if required
if (theHref)
if (theTarget==&quot;top&quot;) top.location.href = theHref;
else if (theTarget==&quot;parent&quot;) parent.location.href = theHref;
else if (theTarget==&quot;blank&quot;) open(theHref,&quot;&quot;);
else content.location.href = theHref;
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top