15.02.2013 Views

JavaScript Examples Bible - UserWorks Technologies

JavaScript Examples Bible - UserWorks Technologies

JavaScript Examples Bible - UserWorks Technologies

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 4 ✦ The Document and Body Objects (Chapter 18)<br />

Listing 18-18: Placeholder for Listing 18-16<br />

<br />

<br />

Placeholder<br />

<br />

<br />

<br />

Figure 4-2 shows an example of the frame written by the script.<br />

Figure 4-2: Clicking the Write To Below button in the upper frame causes a script to<br />

assemble and write HTML for the bottom frame.<br />

A second point to note is that this example customizes the content of the document<br />

based on user input. This customization makes the experience of working<br />

with your Web page feel far more interactive to the user — yet you’re doing it without<br />

any CGI programs running on the server.<br />

The third point I want to bring home is that the document created in the separate<br />

frame by the document.write() method is a genuine document object. In this example,<br />

for instance, the tag of the written document changes if you redraw the<br />

lower frame after changing the entry of the name field in the upper frame. If you click<br />

the lower button after updating the bottom frame, you see that the document.title<br />

property has, indeed, changed to reflect the tag written to the browser in<br />

255<br />

document.write()

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!