HTML and CSS Reference
// ]]> -->
Save this file as documentwrite.html and view it in the browser. The text should display,
as shown in Figure 14.10. If the text does not display, open the Error Console and correct
any errors that appear.
menu commands to see the source code. Close the source code window when you have
finished viewing the code.
Why would I use document.write when I can just type the XHTML
code by itself?
You wouldn't use document.write to generate your Web page if you could just type the
XHTML code by itself. You would use document.write in conjunction with other techniques.
document.write to write “Good morning” to the document. If it is afternoon, write “Good
afternoon” to the document, and if it is after 6:00 p.m., write “Good evening” to the document.
As the user is viewing a Web page, the browser detects mouse movement and events.
Events are actions taken by the Web page visitor, such as mouse clicks, page loads, or
form submissions. For instance, when you move your mouse pointer over a hypertext
link, the browser detects a mouseover event. Table 14.1 lists a few of the events and