Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[[Javascript]] width and height of an element [solved]


  • From: mwarden at gmail.com (Matt Warden)
  • Subject: [[Javascript]] width and height of an element [solved]
  • Date: Mon Sep 25 02:54:59 2006

On 9/24/06, Bernu Bernard <bernu@xxxxxxxxxxxxxxxx> wrote:
> Thank you Matt,
> This are very good links. I finally found what I was looking for
> since a long time.
> I'm on MacOSX and tested IE (5.2.3) , Safari (2.04) , Opera
> (9.0.1)  , Firefox (1.5.0.7) , Camino (1.0.3),
>
> All work with
> elem.clientHeight
>
> PS : the on line lib is false for Safari (it says e.innerHeight
> should work for Safari, but it does not - at least on version 2)

YUI uses offsetHeight.

YAHOO.util.Region.getRegion = function(el) {
    var p = YAHOO.util.Dom.getXY(el);

    var t = p[1];
    var r = p[0] + el.offsetWidth;
    var b = p[1] + el.offsetHeight;
    var l = p[0];

    return new YAHOO.util.Region(t, r, b, l);
};

YUI works with the following browser grading:

http://developer.yahoo.com/yui/articles/gbs/gbs_browser-chart.html
http://developer.yahoo.com/yui/articles/gbs/gbs.html

Thats the nice thing about using a platform like YUI -- you really
don't have to worry as much about this sort of thing, as long as your
standards align with theirs.

-- 
Matt Warden
Cleveland, OH, USA
http://mattwarden.com


This email proudly and graciously contributes to entropy.