15.02.2013 Views

JavaScript Examples Bible - UserWorks Technologies

JavaScript Examples Bible - UserWorks Technologies

JavaScript Examples Bible - UserWorks Technologies

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Window and<br />

Frame Objects<br />

(Chapter 16)<br />

As physical containers of documents, window and frame<br />

objects play huge rolls in scripting. The window object<br />

has been scriptable in one form or another since the first<br />

scriptable browsers. Of course the object has gained numerous<br />

properties, methods, and event handlers over time, but<br />

you also often find many object-model-specific items that you<br />

probably wish were available across all browsers.<br />

While scripts permit Web authors to manage multiple<br />

windows — and many of the examples in this chapter support<br />

that facility — try to think about your visitors, too. Very often<br />

multiple windows get in the way of site navigation and content,<br />

regardless of your good intentions. As some examples<br />

also demonstrate, you must include safety nets for your code<br />

to counteract the unpredictable actions of users who close or<br />

hide windows precisely when you don’t want them to do so.<br />

Therefore, do not regard the multi-window examples here as<br />

user interface recommendations; rather consider them as recommended<br />

ways to handle a potentially tricky user-interface<br />

element.<br />

Possible exceptions to my multi-window admonitions are the<br />

modal and modeless dialog box windows provided by various<br />

versions of IE for Windows. For other platforms, a modal<br />

dialog box can be simulated (search for details at www.<br />

dannyg.com). IE5.5 for Windows also adds a popup type window,<br />

which can be a helpful user interface element that exists<br />

between a tooltip and a modal dialog box.<br />

Modern browsers, however, provide ample script control<br />

over framesets. As examples in this chapter demonstrate,<br />

your scripts can hide and show frames, or completely rearchitect<br />

a frameset without loading a new frameset.<br />

2<br />

C H A P T E R<br />

✦ ✦ ✦ ✦<br />

In This Chapter<br />

Scripting<br />

communication<br />

among multiple<br />

frames<br />

Creating and<br />

managing new<br />

windows<br />

Controlling the size,<br />

position, and<br />

appearance of the<br />

browser window<br />

Dynamically<br />

adjusting frame sizes<br />

and frameset<br />

compositions<br />

✦ ✦ ✦ ✦

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!