Set Div height and width via style height attribute - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Div

Description

Set Div height and width via style height attribute

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  a  v  a 2s . com*/
var d = document.getElementById("d1");
d.style.height = "200px";
    });

      </script> 
   </head> 
   <body> 
      <div id="d1" style="border:1px solid black;">
         asdasd
      </div>  
   </body>
</html>

Related Tutorials