Tips! My Man...
The script will ask the viewer what background and text colors they would like, then the page will display with those colors. Finally, the viewer will be told, in the status bar, "Here's your color background and color text."
The quickest way to implement the user's background and text color requests would be to write them to the <BODY> tag.
This script's main purpose is to write the HTML document's <BODY> tag to the page so we have to make sure that the entire script sits right where the <BODY> sits on the HTML page. And of course, we need to make sure we don't write a <BODY> tag into the HTML document ourselves. We need to let the script do that for us.
Here's the code that writes the <BODY> tag.
document.write("<BODY BGCOLOR=" +color+ " TEXT=" +txtcolor+ ">")
Let's set up an example. If the user enters "blue" as the page background and "yellow" as the text color, this will be written to the page as the <BODY> tag:
<BODY BGCOLOR="blue" TEXT="yellow">
Next Time: How Did That Text Get Into The Status Bar?