Posted By

jodm on 09/18/09


Tagged


Versions (?)

Javascript getstyles


 / Published in: JavaScript
 

URL: http://www.quirksmode.org/dom/getstyles.html

  1. function getStyle(el,styleProp) {
  2. var x = document.getElementById(el);
  3. if (x.currentStyle)
  4. var y = x.currentStyle[styleProp];
  5. else if (window.getComputedStyle)
  6. var y = document.defaultView.getComputedStyle(x,null).getPropertyValue(styleProp);
  7. return y;
  8. }

Report this snippet  

You need to login to post a comment.