Reiner Wirth: z-Index Manipulation

Beitrag lesen

Hallo,

ich habe ein javascript verfaßt, das mir bei jedem onmouseover einer Ebene diese nach oben stellt:

<html><head>  <meta http-equiv="content-type" content="text/html;charset=utf-8">  <script type="text/javascript">    var ziTop=4, idEbene;    function topLifter(ziTop,idEbene)    {      document.getElementById(idEbene).style.zIndex=ziTop;    }  </script>  </head>  <body  bgcolor="#ffeecc">    <div style=" color: blue; background-color: #cccccc; visibility: visible; display: block; position: absolute; z-index: 1; top: 110px; left: 50px; width: 200px; height: 100px;" id="ebene1" onmouseover="topLifter(ziTop,'ebene1');" onmouseout="ziTop=ziTop+1;">Ebene 1</div>    <div style=" color: red;  background-color: #888888; visibility: visible; display: block; position: absolute; z-index: 2; top: 80px; left: 120px; width: 200px; height: 100px;" id="ebene2" onmouseover="topLifter(ziTop,'ebene2');" onmouseout="ziTop=ziTop+1;">Ebene 2</div>    <div style=" color: green;background-color: #333333; visibility: visible; display: block; position: absolute; z-index: 3; top: 50px; left: 190px; width: 200px; height: 100px;" id="ebene3" onmouseover="topLifter(ziTop,'ebene3');" onmouseout="ziTop=ziTop+1;">Ebene 3</div>  </body></html>

das hochzählen des z-Index-Wertes wird durch onmouseout im <div…> veranlaßt.

warum funktioniert nicht auch:

<script type="text/javascript"> var ziTop=100, idEbene; function topLifter(ziTop,idEbene) ziTop=ziTop+1; { document.getElementById(idEbene).style.zIndex=ziTop; } </script>

Vielen Dank

Reiner Wirth