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

x
?
Solved

Show Hide Layers or Drop Down Menu with Checkboxes

Posted on 2004-11-05
2
Medium Priority
?
223 Views
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...

Thanks,
Jon


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

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();
}
MM_reloadPage(true);

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">
    <tr>
      <td class="text"><input name="primarysub" type="checkbox" id="primarysub" value="Cases" checked>
      Cases </td>
    </tr>
    <tr>
      <td class="text"><input name="primarysub" type="checkbox" id="primarysub" value="Statutes" checked>
      Statutes</td>
    </tr>
    <tr>
      <td class="text"><input name="primarysub" type="checkbox" id="primarysub" value="Codes" checked>
      Codes</td>
    </tr>
    <tr>
      <td class="text"><input name="primarysub" type="checkbox" id="primarysub" value="Regulations" checked>
      Regulations</td>
    </tr>
    <tr>
      <td class="text"><input name="primarysub" type="checkbox" id="primarysub" value="Court Orders" checked>
      Court Orders </td>
    </tr>
    <tr>
      <td class="text"><input name="primarysub" type="checkbox" id="primarysub" value="Other Admin Materials" checked>
      Other Admin Materials </td>
    </tr>
  </table>
</div>


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

Accepted Solution

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

Author Comment

by:kerrj
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.

Jon
0

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