daChris: hm... onmoueseover und onmouseout

Beitrag lesen

Hallo,

ich möchte eine Menü machen, dass sich trausschiebt, wenn man's mit der Maus berührt... Aber es fährt teilweise wieder rein, obwohl man halt noch innerhalb des Elements is, was hab ich hier verkehrt gemacht???

Danke im voraus...

Hier der Quellcode:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>bla</title>
<style type="text/css">
 .menu
 {
  overflow:hidden;
  text-align:center;
  white-space:nowrap;
 }

table
 {
  border-collapse:collapse;
  background-color:#99FFCC;
 }
</style>
</head>
<script type="text/javascript">
 var w=0, t;

function init( was )
 {
  document.getElementById( was ).style.width=w;
 }

function her( was )
 {
  if (w<200)
  {
   w+=20;
   document.getElementById( was ).style.width=w;
   if (t) window.clearTimeout( t );
   t=window.setTimeout( "her('"+was+"')", 10 );
  }
 }

function weg( was )
 {
  if (w>0)
  {
   w-=10;
   document.getElementById( was ).style.width=w;
   if (t) window.clearTimeout( t );
   t=window.setTimeout( "weg('"+was+"')", 10 );
  }
 }

</script>

<body>

<table onmouseover="her( 'menu' )" onmouseout="weg( 'menu' )">
<tr>
 <td>+</td> <td>-</td> <td>+</td>
</tr>
<tr>
 <td>|</td> <td>
 <div class="menu" id="menu">

<a href="afdg">Inhalt</a><br/>
 <a href="afdg">Inhtzetzezt</a><br/>
 <a href="afdg">asdgaslt</a><br/>
 <script type="text/javascript">init( "menu" );</script>

</div>
 </td> <td>|</td>
</tr>
<tr>
 <td>+</td><td>-</td><td>+</td>
</tr>
</table>

</body>
</html>