I have my div element which has a className.
i want to grab the display property for this div at runtime in firefox.

i have tried something like this with no luck in firefox or IE; any other ideas

var divObject = document.getElementById("divObjectId");
divObject.style.getExpression("display");

in ff i get an exception "TypeError: divObject.style.getExpression("display"); is not a function"

Thanks

sj

alert = document.getElementById("divObjectId").style.display;

I'm using a external stylesheet so that does not work for fifefox.

I finally got this to work in firefox but its a very clunky. Is there a better way?

this works in ie.

divObject.currentStyle.display;

for firefox

divObject.ownerDocument.styleSheets[3].cssRules[9].style.display;

I don't think firefox has an object like ie were you can look up the current style using javaScript at runtime.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.