Web browsers provide a host environment in which to view a web page downloaded from a remote server or from a local file system. Scripts running in that browser use an object model representation of the browser and the presently viewed document. These are called the Browser Object Model and the Document Object Model respectively. There are objects to represent windows, dialog boxes, alerts, text areas, anchors, frames and all the functionality that the browser provides through its graphical user interface.
The host environment provides a means of connecting events to scripts and those scripts are then triggered when the user interacts with the document or browser. Because the entire complex provides a framework for execution and that execution is event driven, there is no main() function as you would have with the C language for example.
JavaScript that executes in the browser is called client-side script code. Similar script code can be executed in the web server as part of the web page request-response loop. That code would generally be executed in a more serial fashion in response to a single event (generate a page). This sort of activity is called server-side scripting.
A complete web-based application can be built with code distributed between the server and client environments.
Prev | Home | Next |
Web browser | Up | Web server |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. |