Dag mensen,
Ik heb onderstaand bericht op een Engelstalig forum geplaatst, maar ik acht de kans hier groter op een goed antwoord. Zou iemand mij kunnen helpen?
Ik heb onderstaand bericht op een Engelstalig forum geplaatst, maar ik acht de kans hier groter op een goed antwoord. Zou iemand mij kunnen helpen?
I'm working on a website that requires the height detection of a certain <div> named container. Another <div> should be the same height minus a small amount. I got the script for it in a seperate .js file
Code:function height() { var height = document.getElementById('container').clientHeight - 164; document.getElementById('main').style.height = ''+height+'px'; }
This works perfectly in FF, but in IE7, it just gives a gray page and some errors. When I remove the doctype, no errors are caused, but then my design gets messed up (tables and images not connecting tightly). I've read some small posts/articles about clientHeight not being probably read when doctype is used, but I didn't find any working answer yet.
When I remove the part .getElementById('container'), the page does get loaded, but then the script doesn't work (of course). Also, when I change .getElementById('container') into .body or something, the same effect occurs.
Does anyone know a solution to this annoying problem?
(btw my doctype is XHTML 1.0 Transitional)