Leigh L. Klotz, Jr.

Monday, January 15, 2007

Remove HTML Background Marklet

Have you ever come upon a web page that is unreadable because of the background image or color? Try this bookmarklet:
  1. Create a new bookmark in your browser
  2. Put this text in the URL for the bookmark, as one line
  3. Just click on the bookmark when you want to clear the page background.
javascript:(function() {a=document.getElementsByTagName('a'); for(b=0;b<a.length;b++){a[b]. removeAttribute('bgcolor');a[b]. removeAttribute('background');} a=document.getElementsByTagName('head'); for(b=0;b<a.length;b++){var newstyle = document.createElement('style'); newstyle.setAttribute('type', 'text/css'); newstyle.innerHTML='body { background: white; }'; a[b].appendChild(newstyle);}})();

Or, bookmark this