Changing a Page's Background Color
Script 17.2 is simple but powerful. Have you ever visited a site that you knew had lots of useful information, but the background color was so close to the text color that the information was unreadable? Or worse, the page's author used violently clashing colors that made your eyes water? This little bookmarklet solves those problems. Note that at this point, using the bookmarklet changes the way that you're viewing someone else's pagethat's part of the power of bookmarklets. Of course, it doesn't change the actual page, just the way that your browser displays it.
Script 17.2. This script, which changes the background color to white, improves many a design-impaired page.
To change the background color:
This script uses the document.bgColor object and resets it to white. Now, we can see what's actually written, as shown in Figures 17.8 and 17.9.
Figure 17.8. It's difficult to read the text on the page's original background color.
Figure 17.9. Against white, the text is much more legible.
Bookmarklets use single quotes, not double quotes. This is because, behind the scenes, each bookmarklet is inside an <a href=""> tag. Using double quotes would end the bookmarklet prematurely.