# Solved: Change div height w/ Javascript



## cpscdave (Feb 25, 2004)

So I have a div that is solely a colour bar along the left hand side, and initially the height is set by the css. 

Then we have another div in the centre that has a webform. 
But Inside the webform we change the height of other elements based on some inputs. 
How can I get this div to grow/shrink with the webform div? I was thinking by adding a line to the java script that causes the webform div to grow/shrink. But how do I do that? 

Thanks


----------



## Eriksrocks (Aug 7, 2005)

Try

```
document.getElementById("[COLOR="Red"]divName[/COLOR]").style.height = [COLOR="Red"]500[/COLOR]px;
```
Of course replace the divName with the ID of the div and the 500 with your specified height.


----------



## cpscdave (Feb 25, 2004)

Thanks Erik
Exactly what I needed.


----------

