• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 5. Making Content Dynamic > Writing Variable Content

5.1. Writing Variable Content

While a page is loading, you can use the JavaScript document.write() method to fill in content that cannot be stored as part of the document. Example 5.1 shows a simple example of combining hard-wired HTML with dynamically written content to fill a page. In this case, the dynamically written content consists of properties that only the client computer and browser can determine (without the help of a server-based CGI program). The user is oblivious to the fact that a script creates some of the text on the page.

Example 5.1. Combining Fixed and Dynamic Content in a Rendered Page

<HTML>
<BODY>
<H1>Welcome!</H1>
<HR>
<P>You are using version 
<SCRIPT LANGUAGE="JavaScript">
document.write(navigator.appVersion)
document.write(" of the <B>" +  navigator.appName + "</B> browser.")
</SCRIPT>
</P>
</BODY>
</HTML>


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint