JavaScript Tutorials - Herong's Tutorial Examples
Dr. Herong Yang, Version 2.11

Client-Side Scripts for Document Updating

This section provides an overview of client-side scripting. Some scripts are executed to update the page document final rendering. Some scripts are registered as event handler to be executed later.

Server-side scripting for page document updating happens in step 6 and 7a as shown in the diagram below:
Server-Side Scripts for Document Updating

Step 5: The Web server sends the final HTML document to the Web browser.

Step 6 - The Client-side scripting step: The Web browser scans the HTML document for any client-side script code embedded in the document. The Web browser will remove the embedded script code and execute it. When the Web browser executes the embedded script code, it will provide many host objects representing the client host environment. Through those host objects, client-side script code can access the carrying HTML document and the browser windows. Client-side script code can not access the filesystem or anything outside the Web browser on the client machine for security reasons.

Step 7a: Some client-side scripts will update the page document object before it is rendered on the browser window.

Step 7b: Some client-side scripts will be registered as handlers for various events to be triggered on the browser window and it page UI controls. Those scripts will not be executed until their events are triggered by the end user.

Sections in This Chapter

Web Scripting Architecture Overview

Server-Side Scripting Overview

Client-Side Scripts for Document Updating

Client-Side Scripts for Event Handling

Client-Side Scripting Processed Multiple Times

New Script Resulted from Two Original Scripts

Dr. Herong Yang, updated in 2008
Client-Side Scripts for Document Updating