Reposition <div> with Javascript - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Div

Description

Reposition <div> with Javascript

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
window.onload=( function() {//from   ww w .j av  a  2  s  . c o  m
   document.getElementById("Div1").setAttribute("style", "position: absolute; left:297px; top:82px; height: 30px; width: 181px; margin-top: 0px;");
});

      </script> 
   </head> 
   <body> 
      <div id="Div1" style="top:366px; left:134px; position:absolute; height: 30px; width: 175px;">
          hello world 
      </div>  
   </body>
</html>

Related Tutorials