In this example, the text color has been set to brown. If you click on a colored area and the background color is the same as the text color, then the checkColor function will change the background color so the text can be read. Otherwise, no action will be taken by the function.

This comparison is accomplished by comparing the object currentStyle.backgroundColor to the value 'brown.'

Here's some text in a P element. Here's some text in a SPAN in the P. Here's some text in a SPAN within a SPAN.





[Right-click anywhere in the window to view the source code.]



[Right-click and choose View Source from the shortcut menu.]

© 2007 Microsoft Corporation. All rights reserved. Terms of use.