Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[[Javascript]] width and height of an element
- From: bernu at lptmc.jussieu.fr (Bernu Bernard)
- Subject: [[Javascript]] width and height of an element
- Date: Sun Sep 24 15:35:08 2006
You are perfectly right. My mistake was to test item.style["offsetHeight"] instead of item.offsetHeight. I just verified that offsetHeight works as well as clientHeight on all browsers I have (under MacOSX) Bernard Le Sep 24, 2006 ? 8:41 PM, Lee Hinde a ?crit : > I'm glad you found what you are after, but, since I'm touchy, I wanted > to show you how I tested before I sent that link: > > > <html lang="en"> > <head> > <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> > <title>untitled</title> > <meta name="generator" content="TextMate http://macromates.com/"> > <meta name="author" content="Lee Hinde"> > <!-- Date: 2006-09-24 --> > <script type="text/javascript" charset="utf-8"> > function howbig(){ > myitem=document.getElementById("item"); > alert(myitem.offsetHeight); > > } > </script> > </head> > <body> > <div id="item" onclick="howbig()"> > Here I am. > </div> > </body> > </html> > > > That gives me an answer.... > > > > On 9/24/06, Bernu Bernard <bernu@xxxxxxxxxxxxxxxx> wrote: >> Thanks for your response but it does not answer my needs. >> >> The site you mentioned give a size of an element which has that size >> (width or height) already set. >> >> My question is what you do when the browser decides the width and >> size of the element. >> The usual need is when you precise the width and you want to find >> what the browser has set for the height. >> >> When you directly ask the height you get nothing (null or undefined). >> >> Bernard >> Le Sep 24, 2006 ? 6:33 PM, Lee Hinde a ?crit : >> >> > On 9/24/06, Bernu Bernard <bernu@xxxxxxxxxxxxxxxx> wrote: >> >> Hi list, >> >> >> >> How can I find the width and size of an element ? >> >> >> >> Say for example I have : >> >> >> >> <div id="test" onclick="getsizes()">hello</div> >> >> >> >> When I click on "hello" I'd like to get the width and height of >> this >> >> element. >> >> >> >> Bernard >> >> _______________________________________________ >> > >> > >> > Google is your friend. I found this: >> > >> > http://www.aspandjavascript.co.uk/javascript/javascript_api/ >> > get_element_width_height.asp >> > >> > (o, google est vous ami? :-) ) >> > -- >> > Mark Twain: "What gets us into trouble is not what we don't >> know. It's >> > what we know for sure that just ain't so." >> > _______________________________________________ >> > Javascript mailing list >> > Javascript@xxxxxxxxxx >> > https://lists.LaTech.edu/mailman/listinfo/javascript >> >> _______________________________________________ >> Javascript mailing list >> Javascript@xxxxxxxxxx >> https://lists.LaTech.edu/mailman/listinfo/javascript >> > > > -- > Mark Twain: "What gets us into trouble is not what we don't know. It's > what we know for sure that just ain't so." > _______________________________________________ > Javascript mailing list > Javascript@xxxxxxxxxx > https://lists.LaTech.edu/mailman/listinfo/javascript
- References:
- [[Javascript]] width and height of an element
- From: Bernu Bernard
- [[Javascript]] width and height of an element
- From: Lee Hinde
- [[Javascript]] width and height of an element
- From: Bernu Bernard
- [[Javascript]] width and height of an element
- From: Lee Hinde
- [[Javascript]] width and height of an element
- Prev by Date: [[Javascript]] width and height of an element
- Next by Date: [[Javascript]] width and height of an element
- Previous by thread: [[Javascript]] width and height of an element
- Next by thread: [[Javascript]] width and height of an element
- Index(es):