11.12.2012 Views

JavaScript 2.0-The Complete Reference, Second ... - freecodingtutorial

JavaScript 2.0-The Complete Reference, Second ... - freecodingtutorial

JavaScript 2.0-The Complete Reference, Second ... - freecodingtutorial

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.

<br />

Enter some text to store:<br />

<br />

<br />

<br />

When you're through, go to a different page and return.<br />

<strong>The</strong> text will be "as you left it."<br />

<br />

<br />

This application is merely the tip of the iceberg. It is possible to store the entire state of the<br />

page, up to several hundred kilobytes of data, and retrieve it with a simple binding to DHTML<br />

behavior, defined as before. While this technique is highly nonstandard, it seems far preferable<br />

to the amount of work involved with the alternatives, for example, hooking your site into a large<br />

database.<br />

More information about this new technology, including other useful state-storage behaviors, can<br />

be found at the Microsoft Developer‘s Network (http://msdn.microsoft.com).<br />

Work Smarter, Not Harder<br />

You might have picked up on a theme in this chapter: While implementing your own<br />

navigational enhancements is cool, it almost always makes more sense to rely on a third-party<br />

library for non-trivial scripts. <strong>The</strong> amount of testing and cross-browser tweaking necessary to<br />

get complex DHTML functionality working on a variety of platforms and browsers is staggering,<br />

so if at all possible, let someone else do the work for you.<br />

<strong>The</strong>re are many libraries on the Web that you can use. <strong>The</strong>y are usually very well tested, and<br />

accommodate browsers most developers don‘t have easy access to for testing (e.g., old<br />

versions of IE, Safari, IE for Macintosh, Netscape 4 on Solaris, obscure open-source browsers,<br />

and so on). We cannot emphasize enough how much of a time-saving device third-party<br />

DHTML packages can be. Even the authors use them unless we have some compelling reason<br />

not to.<br />

Summary<br />

<strong>JavaScript</strong> can be used to implement an astonishing array of navigational aids ranging from<br />

simple pull-down redirection menu systems to complex CSS-based hierarchical menus. While<br />

such DHTML-based navigation aids are quite powerful, Web developers need to take care that<br />

they accommodate as large a segment of the browser population as possible. Getting scripts to

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

Saved successfully!

Ooh no, something went wrong!