365Chapter 16Window and (Php web hosting) Frame ObjectsDespite the horrible WinIE4+

365Chapter 16Window and Frame ObjectsDespite the horrible WinIE4+ bug just described , it is best to construct the code so that theparent s onloadevent handler triggers all the scripts that you want to run after loading. Youshould also test your pages thoroughly for any residual effects that may accrue if someoneresizes a window or clicks Reload. Blank framesOften, you may find it desirable to create a frame in a frameset but not put any document in ituntil the user has interacted with various controls or other user interface elements in otherframes. Most modern browsers have a somewhat empty document in one of their internalURLs (about:blank). However, this URL is not guaranteed to be available on all browsers. Ifyou need a blank frame, let your framesetting document write a generic HTML document tothe frame directly from the srcattribute for the frame, as shown in the skeletal code inListing 16-3. Loading an empty HTML document requires no additional transactions. Listing 16-3: Creating a Blank Frame Viewing frame source codeStudying other scripters work is a major learning tool for JavaScript (or any programminglanguage). With most scriptable browsers you can easily view the source code for any frame, including those frames whose content is generated entirely or in part by JavaScript. Click thedesired frame to activate it (a subtle border may appear just inside the frame on somebrowser versions, but don t be alarmed if the border doesn t appear). Then select FrameSource (or equivalent) from the View menu (or right-click submenu). You can also print orsave a selected frame. Frames versus frame element objectsWith the expansion of object models that expose every HTML element to scripting (IE4+ andW3C DOM compatible browsers), a terminology conflict comes into play. Everything that youhave read about frames thus far in the chapter refers to the original object model, where aframe is just another kind of window, with a slightly different referencing approach. That stillholds true, even in the latest browsers.

Leave a Reply