a button content box?

hi
i hope i`m asking the question in the right place.
i want to create a content box which will be opened when the user clike on its "header" and closed when the user re-click on it.
so when he clicks the content box open and he can see the content and use it and when he want he can close it.


can it be done and how?


best regards

ron
LVL 1
derridaAsked:
Who is Participating?
 
Jason C. LevineNo oneCommented:
Hi derrida,

You can do this in Dreamweaver by creating Layers and using the built-in Show-Hide Layers behavior.  

Here's a very rough sample:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
<style type="text/css">
<!--
#Layer1 {
      position:absolute;
      width:200px;
      height:115px;
      background-color:#66FFFF;
      layer-background-color:#66FFFF;
      border:1px none #000000;
      z-index:1;
      visibility: hidden;
}
-->
</style>
<script type="text/JavaScript">
<!--
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; }
}
//-->
</script>
</head>

<body>
<p><a href="#" onClick="MM_showHideLayers('Layer1','','show')">This is a header</a></p>
<div id="Layer1">Hi I'm the layer </div>

<p>&nbsp;</p>
</body>
</html>

It's just a little javascript and CSS.

When you click on the header, the layer shows.  If you mess around with the behaviors and search for some tutorial, you can figure out how to make it close (either make a 2nd behavior to double click/close or have a link or graphic in the layer that is set to hide onClick.
0
 
Dushan De SilvaTechnology ArchitectCommented:
What is language or softwaer you using?

BR Dushan
0
 
derridaAuthor Commented:
hi

dreamweaver


ron
0
 
derridaAuthor Commented:
hi
i want to thank you for the reference . i had no idea that i need to do all this. i thought that i am asking a question and getting some help, and that`s it. i hope i`ll learn how to manage my questions effectively.


ron
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.