473,503 Members | 2,313 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

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...

--
Dag.
Dec 20 '06 #1
2 3417
Dag Sunde wrote:
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.
Dec 20 '06 #2
Richard Cornford wrote:
Dag Sunde wrote:
>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.
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/de...css_compat.asp

But thank you for the response.

--
Dag.
Dec 20 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
7235
by: Torbjørn Pettersen | last post by:
I've got a table where I want some of the cells to use a background image. The cells have variable height, so I am using an image with a rather small height to fill up the background of the cells,...
1
686
by: Markus Elfring | last post by:
How much are you interested that the attribute "style" will offer the same or similar capabilities like they are provided by the element "style" in the element "head"? Do you want that the...
2
8641
by: Manuel Reimer | last post by:
Hello, I'm trying to get valid HTML for my homepage. The following links opens the W3C validator with my homepages source: ...
4
4653
by: mike | last post by:
regards: <a href="JavaScript:loadwindow(106,90);" style="font-family:Verdana;">元智Intranet</a> In HTML spec,are "href" and "style" called "attribute"?....@@ Could someone good give me the...
5
17659
by: johnsuth | last post by:
I want to produce a trivial demonstration of dynamic modification. I thought that pressing a button might change its color. I studied O'Reillys books and successfully created the button with a...
1
3277
by: vad | last post by:
Hi, Can anybody explain me, please, what the folder "obj" in VB.NET 2005 for? And what the difference between folders "bin" and "obj"? Thank you.
8
9239
by: fredo | last post by:
This question was asked in comp.lang.javascript with no result. In IE5.x and IE6, I want to display an image when the user rolls over a text link. The image does indeed display, but only on the...
16
4451
by: Tantale | last post by:
I used this serviec to check my webpage http://www.jmrw.com/Abroad/Barcelone/index.htm Made with Dreamweaver 8. The result is 206 errors, most of them "end tag omitted, but OMITTAG NO was...
2
5985
by: CGatto | last post by:
Hi, We have just started getting the following error during compiles of our forms-based application. We are developing in VS2008, VB.Net, with Team Foundation Server-based source control. ...
0
7070
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7267
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7316
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7449
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5566
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4993
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3160
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1495
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
729
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.