<html>
<head>
<title>Background Color Changer</title>
</head>
<body>
<SCRIPT LANGUAGE="JAVASCRIPT">
<!-- This syntax hides JavaScript from older browsers that can't recognize it.
// Single line comments within JavaScript are made with the double forward slash.
// Several lines INCLUDING WHITESPACE can be commented using the /* */ syntax.
/* Below, a VARIABLE called strMessage is declared using the KEYWORD var.
Then a string (text message) enclosed within quotation marks is assigned to
the variable using the equals sign assignment OPERATOR.*/
var strMessage = "In JavaScript, the Document OBJECT has a Write METHOD and a bgColor PROPERTY"
// The page's (document OBJECT) background color is changed using the bgColor PROPERTY.
document.bgColor = "red"
document.bgColor = "yellow"
document.bgColor = "blue"
document.bgColor = "white"
document.bgColor = "red"
document.bgColor = "yellow"
document.bgColor = "blue"
document.bgColor = "white"
document.bgColor = "red"
document.bgColor = "yellow"
document.bgColor = "blue"
document.bgColor = "white"
document.bgColor = "red"
document.bgColor = "yellow"
document.bgColor = "blue"
document.bgColor = "white"
document.bgColor = "red"
document.bgColor = "yellow"
document.bgColor = "blue"
document.bgColor = "white"
document.bgColor = "red"
document.bgColor = "yellow"
document.bgColor = "blue"
document.bgColor = "white"
// 1. The Write METHOD of the document OBJECT is used to write the variable's string message.
// Below the variable strMessage is called.
document.write(strMessage)
// 2. You could also write HTML tags. Here, 4 line breaks are made so that the identical message
// below doesn't run together with the message above. You will only see 4 line break separating
// the two identical lines when the page displays in the web browser.
document.write("<BR><BR><BR><BR>")
// 1.1 You could include the string directly and exclude the variable
document.write("In JavaScript, the Document OBJECT has a Write METHOD and a bgColor PROPERTY")
// 2.1 You could include HTML tags and the string
document.write("<P>" + "JavaScript can write" + "<FONT COLOR = BLUE><B>" + " HTML tags" + "</FONT></B>")
// 2.2 Notice that the concatenation using the plus sign may be taken out
document.write("<P>JavaScript can write<FONT COLOR = BLUE><B> HTML tags</FONT></B>")
// This ends the hide from older browsers syntax enclosing the entire JavaScript-->
</SCRIPT>
</body>
<!-- This is how you comment in HTML outside the <SCRIPT> tags -->
</html>