Posted By

DaveChild on 09/10/09


css javascript

Versions (?)

Who likes this?

1 person have marked this snippet as a favorite


JavaScript Highlight Inline Styles

 / Published in: JavaScript


Puts a red border around anything with an inline style. Prefix with "javascript:" and paste into the address bar to run on a page directly, or run with a load event.

  1. var elements = document.getElementsByTagName("*"); for (i = 0; i < elements.length; i++) { if (elements[i].getAttribute('style')) { var oldstyle = elements[i].getAttribute('style'); elements[i].setAttribute('style', oldstyle + "border: 1px solid #f00;"); } }

Report this snippet  

You need to login to post a comment.