Re: help with document height/width



Garrett Smith wrote:

Thomas 'PointedEars' Lahn wrote:
Adam Yee wrote:
I can't seem to get IE8 to create a working clientHeight or
clientWidth. I've tried a few combinations with varied results, but
nothing that works all the way like in FF.

You don't seem to have powered-up your brain before trying at all, so the
results are unsurprising.

That sounds a little condescending and inflammatory.

It's the hard truth. The OP hasn't done *any* homework before, just copy-
and-pray.

It could end up with you the center of negative attention, as happened
recently.

This is not a help desk, so I don't particularly care what oversensitive
people might think of my postings.

I've tried these (probably a couple others also):
doc_width = document.documentElement.clientWidth;
doc_height = document.documentElement.clientHeight;

Works in Standards Compliance Mode.

doc_width = document.body.offsetWidth + document.body.offsetLeft;
doc_height = document.body.offsetHeight + document.body.offsetTop;

Care to explain what the computed left/top coordinates would have to do
with the width and height of an element?

var doc_height = (document.height !== undefined) ? document.height :
document.body.offsetHeight;

Document objects have no height as they have no graphical representation.

No, but there is a "height" property of document in a few browsers, way
back to NS4, perhaps earlier.

And perhaps irrelevant today?

var doc_width = (document.width !== undefined) ? document.width :
document.body.offsetWidth;

Neither do they have a width.

Can anyone help me out with correct object creation for height and
width (for IE)?

The objects are there, they do not need to be created. RTFM.

That doesn't seem very helpful.

That's too bad. They should ask for a refund.

How could anyone know which manual you are thinking of?

By reading the FAQ and following its recommendations. It is not exactly new
here.

Your posting consisted of nothing but irrelevance. And where is your
counter-suggestion to solve the OP's problem? You should read the FAQ and
adhere to what you are maintaining, otherwise you could rightfully be called
a hypocrite.


PointedEars
--
Danny Goodman's books are out of date and teach practices that are
positively harmful for cross-browser scripting.
-- Richard Cornford, cljs, <cife6q$253$1$8300dec7@xxxxxxxxxxxxxxxx> (2004)
.



Relevant Pages

  • Re: Switch() Statement Not Working
    ... This is recommended in the FAQ only because all other books are worse. ... Because it is the FAQ of _this_ newsgroup, written by and contributed to by ... I do not care much about your real name, at least not in this NetNews ... acceptable as there is no .house top-level domain. ...
    (comp.lang.javascript)
  • Re: SATA hotplug from the user side ?
    ... So, no, you don't really have to care. ... but then this really should be in the SATA hotplug FAQ (or can one ... Care to submit patch to FAQ to Jeff? ... I think this is best solved by udev. ...
    (Linux-Kernel)
  • Re: MTA experts: address rewriting depending on next hop
    ... word if you care, maybe you can prove that Exim's FAQ 805 or 807 iirc ... the link is on d-d - is wrong. ...
    (Debian-User)
  • Re: Taking a little time off, I think
    ... day is the people who's only measure of their self-worth is how ... So the point of life is to stay in a good "mood" and never to feel ... And if it's not covered in the FAQ, ... And I don't care that you don't care! ...
    (rec.food.cooking)
  • Re: The WHOLE POINT of wanting to install games to HDD...
    ... I couldn't care less about the avatar, ... They were already charging a few hundred points here and there for game-related gamerpics. ... HTTP://www.theteafaq.com/ The Tea FAQ ...
    (alt.games.video.xbox)

Loading