Show Hide Layers or Drop Down Menu with Checkboxes

Posted on 2004-11-05
Last Modified: 2012-06-27
I am looking to create a dropdown menu with checkboxes on it.  I have created my page so far in dreamweaver using show/hide layers and I have no problems with that.  The issue is that I want the layer that gets revealed to stay visible until you mouse out of the layer (just like a drop down menu works).  Dreamweaver allows me to hide a layer on mouseout, but that only works when someone mouses out of the link that triggered the 'show' layer.  I want this mouse out to occur when someone mouses out of the layer that gets shown not the link that triggered it.  Hope that makes sense.

I am going to upload my file to in a couple hours so you can see what I am trying to accomplish.  Can't get it up there for a couple hours though. On the sample page:
Link 'One' --> hides on mouseout - which is what I want, but when someone mouses out of the layer revealed and not the link that triggered it.
Link 'two' and above --> does not hide on mouse out so you can see how the scheckboxes work.

Any suggestions...


******* Javascript *********
function set(obj)
var sName =  ;
var bState = obj.checked;
var arr = document.test[sName];
for (i=0; i < arr.length; i++)

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if ( {; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }

****** A Sample Layer ********
<div id="Primary" style="position:absolute; left:151px; top:132px; width:143px; height:114px; z-index:1; visibility: hidden;">
  <table width="100%"  border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#999999" bgcolor="#CCCCCC">
      <td class="text"><input name="primarysub" type="checkbox" id="primarysub" value="Cases" checked>
      Cases </td>
      <td class="text"><input name="primarysub" type="checkbox" id="primarysub" value="Statutes" checked>
      <td class="text"><input name="primarysub" type="checkbox" id="primarysub" value="Codes" checked>
      <td class="text"><input name="primarysub" type="checkbox" id="primarysub" value="Regulations" checked>
      <td class="text"><input name="primarysub" type="checkbox" id="primarysub" value="Court Orders" checked>
      Court Orders </td>
      <td class="text"><input name="primarysub" type="checkbox" id="primarysub" value="Other Admin Materials" checked>
      Other Admin Materials </td>

****** HTML Link to Show Layer (Link 'One') ********
<a href="#" onMouseOver="MM_showHideLayer('Primary','','hide','Secondary','','hide','News','','hide','Public','','hide','jursidiction','','show')"
      <input name="jurisdictionsub" type="checkbox" id="jurisdictionsub" onClick="set(this)" value="jurisdictionsub" checked>    
***** Link to trigger select all checkboxes for category (this works fine) *****
<input name="jurisdictionsub" type="checkbox" id="jurisdictionsub" onClick="set(this)" value="jurisdictionsub" checked>
Question by:kerrj
    LVL 20

    Accepted Solution

    just put the onmouseout into the tag of what you are trying to have exhibit the behavior...
    (your code is rather lengthy for me to browse through)
    but just put the onmouseout code on the <div> instead of the  <a> that it's currently linked to

    Author Comment

    Thanks that was it... just needed a nested div with the mouse out and mouse over on the outer div.  I changed a lot of other things now that I know this.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
    This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
    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…

    779 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

    16 Experts available now in Live!

    Get 1:1 Help Now