/    Sign up×
Community /Pin to ProfileBookmark

IE6 Can’t Handle This

This code just won’t work in IE6, it freezes up the browser everytime. Why is it doing this?

[CODE]if ((document.body.offsetHeight – 225) < document.getElementById(“navigate”).offsetHeight){
document.getElementById(“explore”).style.height = (document.getElementById(“navigate”).offsetHeight + 225) + “px”;
}[/CODE]

Why is it doing this?

to post a comment
JavaScript

8 Comments(s)

Copy linkTweet thisAlerts:
@atripsMay 04.2009 — IE 6 doesn't understand element.offsetHeight well. You have to traverse document towards top and count offset height.
Copy linkTweet thisAlerts:
@GreyfishauthorMay 04.2009 — Well when I do the following code it works fine and gives the result it should.

[CODE]alert((document.getElementById("navigate").offsetHeight + 225) + "px");[/CODE]
Copy linkTweet thisAlerts:
@atripsMay 05.2009 — Not getting exactly what is your problem. Can you please paste your html code where you are getting problem.
Copy linkTweet thisAlerts:
@GreyfishauthorMay 05.2009 — Here's the site.
Copy linkTweet thisAlerts:
@atripsMay 05.2009 — Error in your page is not because of above mentioned code. It's because of this script-

<script type="text/javascript" src="http://www.thewebbakery.com/global/scripts/twitter.js"></script>

you can check by removing this script from your page.
Copy linkTweet thisAlerts:
@GreyfishauthorMay 05.2009 — No that works perfectly fine. I have isolated the error through multiple tests and have come to the conclusion that is it the code I mentioned above.
Copy linkTweet thisAlerts:
@atripsMay 06.2009 — can you please elaborate more about how you are performing your tests?
Copy linkTweet thisAlerts:
@GreyfishauthorMay 06.2009 — Thankyou for your help atrips but my problem is not with how I am testing. I have isolated the problem and it lies in the following code...

[CODE]
if ((document.body.offsetHeight - 225) < document.getElementById("navigate").offsetHeight){
document.getElementById("explore").style.height = (document.getElementById("navigate").offsetHeight + 225) + "px";
}else{
document.getElementById("explore").style.height = 100 + "&#37;";
}
[/CODE]
×

Success!

Help @Greyfish spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...