Web page design - 76 CHAPTER 3 CONTENT CHUNKING PATTERN The
76 CHAPTER 3 CONTENT CHUNKING PATTERN The example JavaScript source code is formatted using object initializers. An object initializer is the persisted form of a JavaScript object. You should not equate an object initializer with a JavaScript class definition; they are two entirely separate things. When an object initializer is processed, an object instance is created, and the identifier of the object instance is the variable declaration. In the example, the variable dynamicFiller is the resulting object instance. The variable dynamicFiller has two properties (generatedAsyncand reference) and two methods (complete and makeCall). The property generatedAsync is an instantiated Asynchronous type and is used to make an asynchronous call to the server. The property reference is the HTML element that will be manipulated by the method complete. The method makeCall is used to make an XMLHttpRequest, and the parameter destination is assigned to the property reference. Putting all the pieces together, the HTML framework code contains general code that references an incomplete variable. To make a variable complete, the JavaScript content is downloaded and executed. The complete variable contains code to download content that is injected into the framework page. Figure 3-13 illustrates the execution sequence of events. Figure 3-13. Sequence of events when downloading and executing JavaScript E B V N
You need excellent and relaible webhost company to host your web applications? Then pay a visit to Inexpensive Web Hosting services.