[Last Call] Learn how to a build a cloud-first strategyRegister Now


Show Hide Layers or Drop Down Menu with Checkboxes

Posted on 2004-11-05
Medium Priority
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 www.fivestarsigns.com/test.htm 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 =  obj.name  ;
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 (obj.style) { obj=obj.style; 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

virmaior earned 2000 total points
ID: 12507783
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

ID: 12514550
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.


Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
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…
Suggested Courses

829 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