Alex: Div verschieben

Beitrag lesen

Alex guck dir das mal an.... das könnte klapen...denke ich:)

<html>
 <head>
  ...
  <style>
body { margin: 0; }

#1 { background-color: #FF6666; width: 200px; height: 60px;
position: absolute; top: 15px; left: 15px; z-index: 3; padding: 5px;
border-width:6px; border-color: silver; border-style: outset; }
#2 { background-color: #FF0000; width: 200px; height: 60px;
position: absolute; top: 80px; left: 15px; z-index: 2; padding: 5px;
border-width:6px; border-color: silver; border-style: outset; }

</style>
  ...
 </head>
 <body>
  <div id="1" onmousedown="this.style.borderStyle='inset';" onclick="document.getElementById('2').style.top = '200px';"
   onmouseup="this.style.borderStyle='outset';">
   element
  </div>
  <div id="2" onmouseover="this.style.zIndex='4';" onmouseout="this.style.zIndex='2';"
   onmousedown="this.style.borderStyle='inset';"onclick="document.getElementById('2').style.top = '80px';" onmouseup="this.style.borderStyle='outset';">
   element
  </div>
 </body>
</html>