Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I change one value in style attribute with JavaScript?

I have a div defined with a style attribute:

<div id="div1" style="width:600;height:600;border:solid 1px"></div>

How can I change the height of the div with JavaScript?

like image 672
David.Chu.ca Avatar asked Mar 25 '09 22:03

David.Chu.ca


1 Answers

<script type="text/javascript">
function changeHeight(height)
{
   document.getElementById("div1").style.height = height + "px";
}
</script>
like image 151
Sebastian Celis Avatar answered Oct 09 '22 00:10

Sebastian Celis