We would like to know how to set height and width for div element.
<!DOCTYPE html>
<html>
<body>
<div id='d1'><div>
<script type='text/javascript'>
<!-- ww w .j a v a 2 s. c o m-->
d = document.getElementById("d1");
d.style.backgroundColor="red";
d.style.width = "300px";
d.style.height="300px";
</script>
</body>
</html>
The code above is rendered as follows: