Solved

How do I keep popup menu parent highlighted?

Posted on 2009-04-01
6
344 Views
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("spaces","location='spaces.html'");

  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'");

   mm_menu_0325080801_0.hideOnMouseOut=true;

   mm_menu_0325080801_0.bgColor='#555555';

   mm_menu_0325080801_0.menuBorder=1;

   mm_menu_0325080801_0.menuLiteBgColor='#FFFFFF';

   mm_menu_0325080801_0.menuBorderBgColor='#FFFFFF';
 

          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'");

   mm_menu_0401112117_0.hideOnMouseOut=true;

   mm_menu_0401112117_0.bgColor='#555555';

   mm_menu_0401112117_0.menuBorder=1;

   mm_menu_0401112117_0.menuLiteBgColor='#FFFFFF';

   mm_menu_0401112117_0.menuBorderBgColor='#FFFFFF';
 

mm_menu_0401112117_0.writeMenus();

} // mmLoadMenus()
 
 

------------------------------
 
 

<table width="124" border="0" cellpadding="5" cellspacing="0" bgcolor="#e0b4b7">

          <tr>

            <td onMouseover="this.bgColor='#f9f0f1'" onMouseout="this.bgColor='#e0b4b7'"><a href="index.html" class="mainNav">&nbsp;home            </a></td>

          </tr>

          <tr>

            <td onMouseover="this.bgColor='#f9f0f1'" onMouseout="this.bgColor='#e0b4b7'"><span class="mainNav">&nbsp;<a href="menus.html">menus            </a></span></td>

          </tr>

          <tr>

            <td onMouseover="this.bgColor='#f9f0f1'" onMouseout="this.bgColor='#e0b4b7'"><span class="mainNav">&nbsp;<a href="winelist.html">wine list        </a></span></td>

          </tr>

          <tr>

            <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>

          </tr>

          <tr>

            <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>

          </tr>

          <tr>

            <td onMouseover="this.bgColor='#f9f0f1'" onMouseout="this.bgColor='#e0b4b7'"><span class="mainNav">&nbsp;<a href="phototour.html">photo tour        </a></span></td>

          </tr>

          <tr>

            <td onMouseover="this.bgColor='#f9f0f1'" onMouseout="this.bgColor='#e0b4b7'"><span class="mainNav">&nbsp;<a href="chef.html">about the chef</a></span></td>

          </tr>

        </table>
 
 

---------------------------------
 

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.menuBgOpaque=opq;

	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

0
Comment
Question by:mnxo4
  • 2
6 Comments
 
LVL 14

Expert Comment

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

Accepted Solution

by:
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!!!



<style>

.over { background-color:#f9f0f1}

.out { #e0b4b7 }

</style>

<script>

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

}
 

</script>

<table width="124" border="0" cellpadding="5" cellspacing="0" bgcolor="#e0b4b7">

          <tr>

            <td id="indexCell" class="mainNav over"><a href="index.html" onMouseOver="swap(this,1)" onMouseOut="swap(this,0)" onClick="clickIt(this)">home</a></td>

          </tr>

          <tr>

            <td id="menusCell" class="mainNav"><a href="menus.html"  onMouseOver="swap(this,1)" onMouseOut="swap(this,0)" onClick="clickIt(this)">menus</a></td>

          </tr>

          <tr>

            <td is="wineCell" class="mainNav"><a href="winelist.html"  onMouseOver="swap(this,1)" onMouseOut="swap(this,0)" onClick="clickIt(this)">wine list</a></td>

          </tr>

Open in new window

0
 
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:

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

on the home page

0
 
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.
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

When you need to keep track of a simple list of numbers or strings, the Array object is your most direct tool.  As we saw in my earlier EE Article (http://www.experts-exchange.com/A_3488.html), typical array handling might look like this: (CODE) B…
In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
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…

760 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now