Web hosting rating - CD-103Chapter 11 .Scripting Frames and Multiple Windows A

CD-103Chapter 11 .Scripting Frames and Multiple Windows A reference from the other sibling back to the first looks the same, but the frames[] array index or frameName part of the reference differs. Of course, much more complex frame hierarchies exist in HTML. Even so, the document object model and referencing scheme provide a solution for the most deeply nested and gnarled frame arrangement you can think of following the same precepts you just learned. Frame Scripting Tips One of the first mistakes that frame scripting newcomers make is writing immedi ate script statements that call upon other frames while the pages load. The prob lem here is that you cannot rely on the document loading sequence to follow the frameset source code order. All you know for sure is that the parent document begins loading first. Regardless of the order of tags, child frames can begin loading at any time. Moreover, a frame s loading time depends on other elements in the document, such as images or Java applets. Fortunately, you can use a certain technique to initiate a script once all of the documents in the frameset are completely loaded. Just as the onLoadevent handler for a document fires when that document is fully loaded, a parent s onLoad event handler fires after the onLoadevent handler in its child frames is fired. Therefore, you can specify an onLoadevent handler in the tag. That handler might invoke a function in the framesetting document that then has the freedom to tap the objects, functions, or variables of all frames throughout the object hierarchy. Controlling Multiple Frames Navigation Bars If you are enamored of frames as a way to help organize a complex Web page, you may find yourself wanting to control the navigation of one or more frames from a static navigation panel. Here, I demonstrate scripting concepts for such control using an application called Decision Helper (which you can find in Chapter 54 on the CD-ROM). The application consists of three frames (see Figure 11-3). The top- left frame is one image that has four graphical buttons in it. The goal is to turn that image into a client-side image map and script it so the pages change in the right- hand and bottom frames. In the upper-right frame, the script loads an entirely dif ferent document along the sequence of five different documents that go in there. In the bottom frame, the script navigates to one of five anchors to display the segment of instructions that applies to the document loaded in the upper-right frame. Listing 11-1 shows a slightly modified version of the actual file for the Decision Helper application s navigation frame. The listing contains a couple of new objects and concepts not yet covered in this tutorial. But as you will see, they are exten sions to what you already know about JavaScript and objects. To help simplify the discussion here, I remove the scripting and HTML for the top and bottom button of the area map. In addition, I cover only the two navigation arrows.
We would like to recommend you tested and proved virtual web hosting services, which you will surely find to be of great quality.

Leave a Reply