Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

How do I keep popup menu parent highlighted?

Posted on 2009-04-01
Last Modified: 2012-05-06
I'm creating popup menus in Dreamweaver 8 using the behaviors library (onMouseover & onMouseout). They work fine, but what I'd like is that when the mouse is over the popup menu choices, the parent object (that you rollover to get the popup menu to appear) stays highlighted. Is there a variable somewhere I need to alter? Is there a way to differentiate a regular onMouseout event from a popup rollover?

Attached code is the script call in the document head, followed by the onMouse events on the pages, and finally the first part of the.js file code.

thank you!
function mmLoadMenus() {
  if (window.mm_menu_0325080801_0) return;
            window.mm_menu_0325080801_0 = new Menu("root",132,16,"Geneva, Arial, Helvetica, sans-serif",9,"#333333","#333333","#f9f0f1","#FFFFFF","left","middle",10,0,500,-5,7,true,false,true,0,true,true);
  mm_menu_0325080801_0.addMenuItem("catering menus","location='cateringmenus.html'");
  mm_menu_0325080801_0.addMenuItem("catering FAQs","location='cateringfaqs.html'");
  mm_menu_0325080801_0.addMenuItem("just for weddings","location='justweddings.html'");
          window.mm_menu_0401112117_0 = new Menu("root",131,15,"Geneva, Arial, Helvetica, sans-serif",9,"#333333","#333333","#f9f0f1","#FFFFFF","left","middle",3,0,500,-5,7,true,false,true,0,true,true);
  mm_menu_0401112117_0.addMenuItem("press releases","location='press.html'");
  mm_menu_0401112117_0.addMenuItem("media downloads","location='press.html'");
} // mmLoadMenus()
<table width="124" border="0" cellpadding="5" cellspacing="0" bgcolor="#e0b4b7">
            <td onMouseover="this.bgColor='#f9f0f1'" onMouseout="this.bgColor='#e0b4b7'"><a href="index.html" class="mainNav">&nbsp;home            </a></td>
            <td onMouseover="this.bgColor='#f9f0f1'" onMouseout="this.bgColor='#e0b4b7'"><span class="mainNav">&nbsp;<a href="menus.html">menus            </a></span></td>
            <td onMouseover="this.bgColor='#f9f0f1'" onMouseout="this.bgColor='#e0b4b7'"><span class="mainNav">&nbsp;<a href="winelist.html">wine list        </a></span></td>
            <td bgcolor="#f9f0f1"><span class="mainNav"><a href="events.html" name="link2" id="link1" onmouseover="MM_showMenu(window.mm_menu_0325080801_0,122,-6,null,'link2')" onmouseout="MM_startTimeout();">&nbsp;events &amp; catering</a></span></td>
            <td onMouseover="this.bgColor='#f9f0f1'" onMouseout="this.bgColor='#e0b4b7'"><span class="mainNav">&nbsp;<a href="media.html" name="link3" id="link1" onmouseover="MM_showMenu(window.mm_menu_0401112117_0,118,-6,null,'link3')" onmouseout="MM_startTimeout();">media            </a></span></td>
            <td onMouseover="this.bgColor='#f9f0f1'" onMouseout="this.bgColor='#e0b4b7'"><span class="mainNav">&nbsp;<a href="phototour.html">photo tour        </a></span></td>
            <td onMouseover="this.bgColor='#f9f0f1'" onMouseout="this.bgColor='#e0b4b7'"><span class="mainNav">&nbsp;<a href="chef.html">about the chef</a></span></td>
function Menu(label, mw, mh, fnt, fs, fclr, fhclr, bg, bgh, halgn, valgn, pad, space, to, sx, sy, srel, opq, vert, idt, aw, ah) 
	this.version = "020320 [Menu; mm_menu.js]";
	this.type = "Menu";
	this.menuWidth = mw;
	this.menuItemHeight = mh;
	this.fontSize = fs;
	this.fontWeight = "plain";
	this.fontFamily = fnt;
	this.fontColor = fclr;
	this.fontColorHilite = fhclr;
	this.bgColor = "#555555";
	this.menuBorder = 1;
	this.menuItemBorder = 1;
	this.menuItemIndent = idt;
	this.menuItemBgColor = bg;
	this.menuItemVAlign = valgn;
	this.menuItemHAlign = halgn;
	this.menuItemPadding = pad;
	this.menuItemSpacing = space;
	this.menuLiteBgColor = "#ffffff";
	this.menuBorderBgColor = "#777777";
	this.menuHiliteBgColor = bgh;
	this.menuContainerBgColor = "#cccccc";
	this.childMenuIcon = "arrows.gif";
	this.submenuXOffset = sx;
	this.submenuYOffset = sy;
	this.submenuRelativeToItem = srel;
	this.vertical = vert;
	this.items = new Array();
	this.actions = new Array();
	this.childMenus = new Array();
	this.hideOnMouseOut = true;
	this.hideTimeout = to;
	this.addMenuItem = addMenuItem;
	this.writeMenus = writeMenus;
	this.MM_showMenu = MM_showMenu;
	this.onMenuItemOver = onMenuItemOver;
	this.onMenuItemAction = onMenuItemAction;
	this.hideMenu = hideMenu;
	this.hideChildMenu = hideChildMenu;
	if (!window.menus) window.menus = new Array();
	this.label = " " + label;
	window.menus[this.label] = this;
	window.menus[window.menus.length] = this;
	if (!window.activeMenus) window.activeMenus = new Array();

Open in new window

Question by:mnxo4
  • 2
LVL 14

Expert Comment

ID: 24142122
There is insufficient information to proceed.
LVL 75

Accepted Solution

Michel Plungjan earned 250 total points
ID: 24145383
Strange the attachement is now visible

Assuming the links change a frame or an iframe you can do something like this
NOTE: BE MORE CONSISTENT - do not use spans everywhere and clean up the whitespace before and after text and tags!!!

.over { background-color:#f9f0f1}
.out { #e0b4b7 }
var saveCell = "";
function swap(lnk,on) {
  var currentCell = lnk.parentNode.id;
  if (saveCell == currentCell) return;
  if (saveCell) document.getElementById(saveCell).className="mainNav out";
  document.getElementById(currentCell).className=(on)?"mainNav over":"mainNav out";
function clickIt(lnk) {
  saveCell = lnk.parentNode.id
<table width="124" border="0" cellpadding="5" cellspacing="0" bgcolor="#e0b4b7">
            <td id="indexCell" class="mainNav over"><a href="index.html" onMouseOver="swap(this,1)" onMouseOut="swap(this,0)" onClick="clickIt(this)">home</a></td>
            <td id="menusCell" class="mainNav"><a href="menus.html"  onMouseOver="swap(this,1)" onMouseOut="swap(this,0)" onClick="clickIt(this)">menus</a></td>
            <td is="wineCell" class="mainNav"><a href="winelist.html"  onMouseOver="swap(this,1)" onMouseOut="swap(this,0)" onClick="clickIt(this)">wine list</a></td>

Open in new window

LVL 75

Expert Comment

by:Michel Plungjan
ID: 24145389
If you load a new page each time, then it is much easier, just remove the scripts from the link of the page you are on:

            <td id="indexCell" class="mainNav over">home</td>

on the home page

LVL 16

Expert Comment

by:CWS (haripriya)
ID: 37089677
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Avoid defining the variables in the global scope; trying to define them in a local function scope. Because:   • Look-up is performed every time a variable is accessed.   • Variables are resolved backwards from most specific to least specific scope…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question