IE problem with offsetWidth

Giganews Newsgroups
Subject: IE problem with offsetWidth
Posted by:  Beni Rose (beniro…
Date: 6 Sep 2006

I'm trying to build some dynamic vertical drop down menus (pop out
menus?) and I'm having some trouble. I'm trying to get the width of the
span tag that the root level menu item is in, because it's going to be
different every time (it's a solution for a template driven website
solution). I'm not assigning the width in my javascript for the same
reason. So when I do span.width or I get undefined.
However, in Safari and Firefox, I can use offsetWidth to get the
alloted width of my span tag. In IE, however, my offsetWidth is 0, as
well as any other width alternative I could find.

So my question is, if I don't set the width of an object, how can I
retrieve the width alloted to it by the browser. Again, it's a span
tag. I could use div if it makes a difference, but IE doesn't fire
onmouseover when you mouse over empty space in a div tag, so that's why
I went with a span.