No, I believe this is correct behavior per the DOM 2
CSS spec. You will need to use getComputedStyle() or
actually read the styleSheet rules directly through
the DOM 2 Style Sheets interface.
Examples:
document.styleSheets.item(0).cssRules.item(0).style.getPropertyValue("text-decoration");
should give you the text-decoration for the first rule
in your linked style sheet
document.getElementsByTagName("link")[0].sheet;
will give access to the sheet in the first link tag
document.defaultView.getComputedStyle(document.getElementsByTagName("div")[0],null).getPropertyValue("width")
will give you the computed style for the width of the
first div in a document.
Refer to the DOM 2 CSS and Style Sheets spec. for more
information.
-Dylan Schiemann
--- Andrew <[EMAIL PROTECTED]> wrote:
> Hi all!
>
> I've been experimenting a lot with Netscape's latest
> Mozilla release and I
> wonder I anyone of you has come across this problem:
> Whenever I <link> to a
> css-file in a documents head and try to access the
> css-data in the
> corresponding layer using JavaScript, it seems
> impossible to access. For
> example, if I try to read a layer's height by:
>
>
parseInt(document.getElementById('mylayer').style.height)
>
> which definitely IS the correct method to do this, I
> only get an "NaN".
> How's this possible?
>
> Vice versa, if I define an INLINE-STYLE in the
> corresponding <div>-tag
> instead of linking to an external css-file (which is
> exactly the thing that
> W3C tries to keep us from, isn't it?), the same
> method returns the correct
> results. Is this a bug or am I missing something?
> Please help if you can,
> I'm desperate.
>
> Andrew
>
>
>
>
>
__________________________________________________
Do You Yahoo!?
Yahoo! Shopping - Thousands of Stores. Millions of Products.
http://shopping.yahoo.com/