Home Back
     
 

 

 

Basismap Intra- Internet programmeren
Categorie Programmeren Collaps Expand win - linux - netscape - firefox
Voorbeeld van in- en uitklappen en het gebruik van layers .
Example expand - collaps and using layers <div>
Code test:
» Windows IE 6.0 :: Netscape 7.2
» LINUX Galeon :: Konqueror :: Mozilla :: Netscape [Slackware 10.0 - versies]

DEMO :
http://www.tribuun.com/Kantoren/projectdemo/div_ie_n7.html
 
Code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<!--
==   Auteur : piet willems  2004
==   Javafuncties werkend op Linux Galeon | Kongueror | Mozilla | Netscape
==   Getest op:
==   Versies gebruikt in Linux Slackware 10.0 == http://slackware.org 
==   Versies Windows : IE 6.0 en Netscape 7.2
==   Gebruikte eigenschappen:
==   - innerHTML : tekst in td-tag
==   - className : class meegeven aan element
==   - visibility : div-tag
==   - display : none , block
==   Gebruik van de code : vermeld aub [code :pwProTech]
==   Using the code please mention :  [code :pwProTech]
// -->

<title>Java-functies Collaps expand | Layers IE NETSCAPE</title>

<script language="JavaScript">
<!--
//browserName = navigator.appName; voor browserversie
//browserVer=parseInt(navigator.appVersion);


var IE;   // Explorer
var N;    // Netscape
var N7;   // Netscape 7

if (document.all){IE=1;N=0;N7=0;}
else if (document.layers){IE=0;N=1;N7=0;}
else if (document.getElementById){IE=0;N=0;N7=1;}


function show(id_naam)
{
hide('menu1');hide('menu2');
  window.OnError = null;
  if(id_naam == "")         
  {
    return null;
  }
  if(IE) {document.all[id_naam].style.visibility = "visible";
           document.all.info1.innerHTML="IE";
           document.getElementById('info1').className="informatie";
           }
  if(N)  {document.layers[id_naam].visibility = "show";document.getElementById('info1').innerHTML="Netscape";} 
  if(N7) {document.getElementById(id_naam).style.visibility = "visible";
           document.getElementById('info1').innerHTML="Netscape 7 || 7+ ";
           document.getElementById('info1').className="informatie";
           }
 return null;
}

function hide(id_naam)

{
  window.OnError = null;
  if(IE)document.all[id_naam].style.visibility            = "hidden";
  if(N)   document.layers[id_naam].visibility               = "hide";
  if(N7) document.getElementById(id_naam).style.visibility = "hidden";
}

function expand(id_naam){

    if(document.getElementById){
      if(document.getElementById(id_naam).style.display == "none")
         {document.getElementById('item1').style.display = "none";
         document.getElementById('item2').style.display = "none";
         document.getElementById(id_naam).style.display = "block";}
    else
      document.getElementById(id_naam).style.display = "none";
    }
  }




// -->
</script>
<style>
.informatie {font-family:verdana;font-size:10pt;font-weight:bold;color:FF0000};
</style>

</head>

<body link="#008000" vlink="#008000" alink="#FF0000">
   <table border="0" width="170" height="10" cellspacing="0" cellpadding="0">
   <tr>
      <td id="info1" height="23" width="200"><b><font size="2" face="Verdana">
      Hoofdmenu</font></b></td>
   </tr>   
   <tr>
      <td height="12" valign="top" width="200"><b><font face="Verdana" size="1"><a onMouseOver="expand('item1')">Item 1</a></font></b></td>
   </tr>
   
   <tr>   
   <td id="info" valign="top" width="200">
         <div  id="item1" onMouseDown="expand('item1')" style="display:none ; position: relative;">
         <table border="0" height = "0" width="100%">
            <tr>
               <td height="10" width="200" bgcolor="#FFFFEA" style="border: 1px solid #B7B700">
               <blockquote>
                  <b><font face="Verdana" size="1">hjkshkqj</font></b><br>
                  <b><font face="Verdana" size="1">hqkjhdkq</font></b><br>
                  <b><font face="Verdana" size="1">hjkshkqj</font></b><br>
                  <b><font face="Verdana" size="1">hqkjhdkq</font></b><br>
                  <b><font face="Verdana" size="1">hjkshkqj</font></b><br>
                  <b><font face="Verdana" size="1">hqkjhdkq</font></b><br>
                  <b><font face="Verdana" size="1" color="#FF0000"><u>
                  »<a href="#">Sluit</a></u></font></b></p>
               </blockquote>
               </td>
            </tr>
         </table>
         </div>
   </td>
   </tr>
   <tr>
      <td height="12" valign="top" width="200"><b><font face="Verdana" size="1"><a onMouseOver="expand('item2')">Item 2</a></font></b></td>
   </tr>
   
   <tr>   
   <td id="info" valign="top" height="10" width="200">
         <div  id="item2" onMouseDown="expand('item2')" style="display:none ; position: relative;">
         <table border="0" width="169">
            <tr>
               <td width="161" bgcolor="#FEEBD3" style="border: 1px solid #A25A04">
               <ul>
                  <li><b><font face="Verdana" size="1">hjkshkqj</font></b><br>
                  <b><font face="Verdana" size="1">hqkjhdkq</font></b></li>
                  <li><b><font face="Verdana" size="1">jkljlk jsl</font></b></li>
                  <li><b><font face="Verdana" size="1">jlsdkjlsd</font></b></li>
                  <li><b><font face="Verdana" size="1" color="#FF0000">
                  »
                  Sluit</font></b></li>
               </ul>
               </td>
            </tr>
         </table>
         </div>
   </td>
   </tr>   
   </table>

<table width="236">
<td colspan="2"></td></tr>


<tr><td width="79">
   <font face="Verdana" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b><br>
   <a href="" onMouseOver="show('menu1')">item1</a><br>
   <a href="" onMouseOver="show('menu2')">Menu 2</a><br>
   </b></font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b>
</td><td width="147">
<div onMouseOver="show('menu1')" onMouseout ="hide('menu1')" id="menu1" style="visibility:hidden; position: relative; left: 0px; top: 0px; height: 75px; width: 115px">
 <table  xwidth=160 border=0 cellpadding=2 cellspacing=0 width="144" height="75" bgcolor="#C0C0C0">
  <tr>

   <td  style="border:1px solid #000000; ">
   <p align="left"><b><font face="Verdana" size="2">
   <a href="" >Item1</a><br>
    <a href="">Item 2</a></font></b><br>
   </td>
  </tr>
 </table>
</div>

</td></tr>
<tr><td colspan="2"></td></tr>
</table>

   


<div id="menu2" onMouseOver="show('menu2')" onMouseout ="hide('menu2')" style="visibility:hidden; position: absolute; left: 80px; top: 30px; width: 170px; height: 346px">

            <table height="87%" cellSpacing="4" width="100%">
               <tr>
                  <td style="border-style:solid; border-width:1px; " height="14" bgcolor="#E1E1E1">
                  <font face="Verdana" color="#814702" size="1">
                     <dl>
                        <dt><b>
                        <a target="inhoud" href="http://users.pandora.be/pwProTech/oww/aperitief/index.htm">Aperitieven</a></b>
                        </dt>
                        <dt><b>
                        <a target="inhoud" href="http://users.pandora.be/pwProTech/oww/chips/index.htm">Chips</a></b>
                        </dt>
                        <dt><b>
                        <a target="inhoud" href="http://users.pandora.be/pwProTech/oww/chocolade/index.htm">Chocolade</a></b>
                        </dt>
                        <dt><b>
                        <a target="inhoud" href="http://users.pandora.be/pwProTech/oww/confituurenbeleg/index.htm">Confituur en ander beleg</a></b>
                        </dt>
                        <dt><b>
                        <a target="inhoud" href="http://users.pandora.be/pwProTech/oww/conserven/index.htm">Conserven</a></b>
                        </dt>
                        <dt><b>
                        <a target="inhoud" href="http://users.pandora.be/pwProTech/oww/fruitsap/index.htm">Fruitsap</a></b>
                        </dt>
                        <dt><b>
                        <a target="inhoud" href="http://users.pandora.be/pwProTech/oww/gedroogdfruit/index.htm">Gedroogd fruit</a></b>
                        </dt>
                        <dt><b>
                        <a target="inhoud" href="http://users.pandora.be/pwProTech/oww/honing/index.htm">Honing</a></b>
                        </dt>
                        <dt><b>
                        <a target="inhoud" href="http://users.pandora.be/pwProTech/oww/koekjes/index.htm">Koekjes</a></b>
                        </dt>
                        <dt><b>
                        <a target="inhoud" href="http://users.pandora.be/pwProTech/oww/koffie/index.htm">Koffie</a></b>
                        </dt>
                        <dt><b>
                        <a target="inhoud" href="http://users.pandora.be/pwProTech/oww/koffiefilters/index.htm">Koffiefilters</a></b>
                        </dt>
                        <dt><b>
                        <a target="inhoud" href="http://users.pandora.be/pwProTech/oww/melkdranken/index.htm">Melkdranken</a></b>
                        </dt>
                        <dt><b>
                        <a target="inhoud" href="http://users.pandora.be/pwProTech/oww/noten/index.htm">Noten</a></b>
                        </dt>
                        <dt><b>
                        <a target="inhoud" href="http://users.pandora.be/pwProTech/oww/olie/index.htm">Olie</a></b>
                        </dt>
                        <dt><b>
                        <a target="inhoud" href="http://users.pandora.be/pwProTech/oww/granenenrijst/index.htm">Ontbijt-granen en rijst</a></b>
                        </dt>
                        <dt><b>
                        <a target="inhoud" href="http://users.pandora.be/pwProTech/oww/rodewijn/index.htm">Rode wijn</a></b>
                        </dt>
                        <dt><b>
                        <a target="inhoud" href="http://users.pandora.be/pwProTech/oww/sauzen/index.htm">Sauzen</a></b>
                        </dt>
                        <dt><b>
                        <a target="inhoud" href="http://users.pandora.be/pwProTech/oww/snoep/index.htm">Snoep</a></b>
                        </dt>
                        <dt><b>
                        <a target="inhoud" href="http://users.pandora.be/pwProTech/oww/snoeprepen/index.htm">Snoeprepen</a></b>
                        </dt>
                        <dt><b>
                        <a target="inhoud" href="http://users.pandora.be/pwProTech/oww/specerijen/index.htm">Specerijen</a></b>
                        </dt>
                        <dt><b>
                        <a target="inhoud" href="http://users.pandora.be/pwProTech/oww/sterkedrank/index.htm">Sterke drank</a></b>
                        </dt>
                        <dt><b>
                        <a target="inhoud" href="http://users.pandora.be/pwProTech/oww/suiker/index.htm">Suiker</a></b>
                        </dt>
                        <dt><b>
                        <a target="inhoud" href="http://users.pandora.be/pwProTech/oww/thee/index.htm">Thee</a></b>
                        </dt>
                        <dt><b>
                        <a target="inhoud" href="http://users.pandora.be/pwProTech/oww/wittewijn/index.htm">Witte wijn</a></b>
                        </dt>
                  </dl>
                  </font></td>
               </tr>
            </table>

</div>


</body>
</html>


Onmouseout can be changed in onmouseclick or onclick.
Voor sommige toepassingen is het beter de onmouseout te vervangen door onclick of onmouseckick.
 

Copyright (c) 2005 :: willems piet