ldsmike88 Posted March 20, 2007 Share Posted March 20, 2007 Every time I try to set the heigth of a div equal to the height of the document it freezes up. How do I make this work? Thanks! function MyWindowResized(){ var myWindowHeight = document.body.clientHeight; document.getElementById('main').style.height = myWindowHeight + 'px'; } Link to comment https://forums.phpfreaks.com/topic/43417-solved-element-height/ Share on other sites More sharing options...
ldsmike88 Posted March 20, 2007 Author Share Posted March 20, 2007 Fixed it! Apparently if you use 'body' it just gets the height of the document. If you use documentElement it gets the height of the window. function windowResized(){ document.getElementById('main').style.height = document.documentElement.clientHeight - 50; document.getElementById('side').style.height = document.documentElement.clientHeight - 50; document.getElementById('main').style.width = document.body.clientWidth - 215; document.getElementById('side').style.width = 200; } Link to comment https://forums.phpfreaks.com/topic/43417-solved-element-height/#findComment-210900 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.