Get All Element Styles inside javascript
krithika <[email protected]>
| Newsgroups | gmane.comp.mozilla.devel.dom |
|---|---|
| Organization | http://groups.google.com |
| Message-ID | <a7305f52-71db-4017-8492-3a32178061d2@d32g2000yqh.googlegroups.com> |
I would like to know if I can get all styles of an element ( from
style node , external css and inline css) inside javascript.
Iam able to get individual styles from
document.defaultView.getComputedStyle(x,null).getPropertyValue
(styleProp); as shown
Is it possible to list all style properties configured and then get
the values?.
Thanks in Advance,
Krithi
function getStyle(el,styleProp)
{
var x = document.getElementById(el);
if (x.currentStyle)
var y = x.currentStyle[styleProp];
else if (window.getComputedStyle)
var y = document.defaultView.getComputedStyle
(x,null).getPropertyValue(styleProp);
return y;
}