<html><head><title> DIV-i kiht </title>
  <script language="Javascript1.2">

     var kasIE=false;
     if(window.navigator.userAgent.indexOf("MSIE")>=0) kasIE=true;
     var uusx=0, uusy=0, nihkex=0, nihkey=0;
     var x=0, y=0, vanax=0, vanay=0;

     function paiguta(){
       if(kasIE){
         document.all["kiht1"].style.left=x;
         document.all["kiht1"].style.top=y;
         nihkex=0.5*nihkex+0.5*document.body.scrollLeft;
         nihkey=0.5*nihkey+0.5*document.body.scrollTop;
         x=nihkex+document.body.clientWidth/2;  
         y=nihkey+document.body.clientHeight/2;
       } else {
         document.layers["kiht1"].left=x;
         document.layers["kiht1"].top=y;
         nihkex=0.5*nihkex+0.5*window.pageXOffset;
         nihkey=0.5*nihkey+0.5*window.pageYOffset;
         x=nihkex+window.innerWidth/2;  
         y=nihkey+window.innerHeight/2;
       }       
     }

  </script>
</head>
<body >
  <h3>Kiht nihkub akna keskele</h3>
  <form>
    <input type=button onClick='setInterval("paiguta()", 100);'>
  </form>
 <div id="kiht1" style="position:absolute; left:100; top:100;">
   <table bgcolor="yellow">
    <tr><td><a href="http://www.neti.ee">Neti</a></td>
    <tr><td><a href="http://www.tpu.ee">TPU</a></td>
   </table>
 </div>
 <script>
   //luuakse pikk tekst
   for(var i=0; i<500; i++){
     document.writeln("I<br>");
   }
   for(var i=0; i<500; i++){
     document.write("-");
   }
 </script>
</body></html>

