Javascript getstyles


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your 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. }

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.