Manipulating "obj.style.height " don't work in IE7...?

D

Dag Sunde

I have the following function to resize a div element (Content) depending on
the
size of another div element (leftConent).

function adjustContentHeight() {
var content = document.getElementById("Content");
var leftOne = document.getElementById("leftContent ");
content.style.height = (leftOne.offsetHeight + leftOne.offsetTop) + "px";

return true;
}


This code works as expected in IE6 and FF2.0, but when testing in IE7
nothing
happens... the "Content" div is not resized.

Can anyone shed some light on why?

TIA...
 
R

Richard Cornford

Dag said:
I have the following function to resize a div element
(Content) depending on the
size of another div element (leftConent).

function adjustContentHeight() {
var content = document.getElementById("Content");
var leftOne = document.getElementById("leftContent ");
content.style.height = (leftOne.offsetHeight + leftOne.offsetTop) +
"px";

return true;
}

This code works as expected in IE6 and FF2.0, but when
testing in IE7 nothing
happens... the "Content" div is not resized.

Can anyone shed some light on why?

CSS changes in IE 7 appear to be having knock-on effects for scripts.
Earlier in the week I traced an instance of a block of dynamically
generated elements not showing in IE 7 to a containing DIV that had been
set to position:relative, and as a result had started reporting zero
offsetWidth, wen though it had width:100% and a screen-width CSS
positioned container (probably a consequence of that DIV only having
absolutely positioned descendants and so not having any flowable
content). Switching the DIV to position:absolute solved that problem as
then the DIV did report its offsetWidth as non-zero (and it had never
needed to be relatively positioned to start with).

In any event, you won't get others to identify your problems with script
alone. They need to see the mark-up and the CSS to attribute genuine
cause and effect relationships. That is, you should create a cut down
test-case page that demonstrates the issue in isolation.

Richard.
 
D

Dag Sunde

Richard said:
CSS changes in IE 7 appear to be having knock-on effects for scripts.
Earlier in the week I traced an instance of a block of dynamically
generated elements not showing in IE 7 to a containing DIV that had
been set to position:relative, and as a result had started reporting
zero offsetWidth, wen though it had width:100% and a screen-width CSS
positioned container (probably a consequence of that DIV only having
absolutely positioned descendants and so not having any flowable
content). Switching the DIV to position:absolute solved that problem
as then the DIV did report its offsetWidth as non-zero (and it had
never needed to be relatively positioned to start with).

In any event, you won't get others to identify your problems with
script alone. They need to see the mark-up and the CSS to attribute
genuine cause and effect relationships. That is, you should create a
cut down test-case page that demonstrates the issue in isolation.

I know, but I dreaded the task of ripping that page down to a simple
example actually reproducing the problem. It's a closed intranet
page, heavy with JS manipulation runtime. (You know, one of those
where you don't have to care about missing JS or other browsers than
IE).

It turned out to be more of a css-problem, really...
Something like the sample at the bottom of this page:
http://msdn.microsoft.com/library/d...-us/IETechCol/cols/dnexpie/ie7_css_compat.asp

But thank you for the response.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,563
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top