JS, the DOM and CSS
by "Hilma" <Hilma(at)hilma.freeserve.co.uk>
|
|
Hi -
i hope someone can help on this one - and i hope i'm in the correct palce
for it!
I'm trying to find out, via JS, the value of particular property
within a particular class, as defined in a style sheet;
e.g. i want to know the width of anything that has class "NavButton", (where
that
class has the width defined in a .css)
I've got as far as
mySheet = document.Sheets[0]
but when i try to access
(1) RuleCount = document.Sheets[0].cssRules.length
or
(2) FirstRule= document.Sheets[0].cssRules[0]
(and ultimately
(3) NavWidth = document.Sheets[0].cssRules['NavButton'].width)
i come up with errors: "Not an object or is null".
I think i'm using the syntax from my JS book, and i want it to work in
IE6 and NS6; but cannot get further into the sheets array than
discovering that it has one element :
SheetCount = document.Sheets.length
succesfully returns 1!
Many thanks for any ideas -
h.
HWG hwg-techniques mailing list archives,
maintained by Webmasters @ IWA