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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>JavaScript</strong> libraries on the Web such as HierMenus<br />

(http://www.webreference.com/dhtml/hiermenus/) before you go about rolling your own<br />

menu script.<br />

Remote Control Menus<br />

Remote control menus are pop-up windows that control the behavior of the main browser<br />

window. Chapter 12 covered the essentials of manipulation of one window by another, and the<br />

same techniques apply here. <strong>The</strong>se types of menus are often useful if you need to present the<br />

user with a large number of complex capabilities. Often, screen real estate is at a premium, and<br />

a large menu of actions appearing in the main content window might clutter the interface<br />

unnecessarily.<br />

<strong>The</strong> basic idea is to window.open() a new control window from the main content window. <strong>The</strong><br />

remote control window would have buttons, links, or menus of actions, and would carry out the<br />

necessary functionality in the main browser window by using its window.opener reference.<br />

You may find it useful to invoke the focus() method of the window being controlled after the<br />

user performs an action in the control panel. Doing so improves usability by freeing the user<br />

from having to focus the content window manually. Additionally, windows containing remote<br />

control menus are often brought up ―naked,‖ that is, without scrollbars, browser buttons, or a<br />

location bar. To bring up a window this way, pass the empty string as the third argument to<br />

window.open(), or use the configuration string options covered in Chapter 12 to turn off the<br />

features you don‘t want.<br />

As a concrete example, suppose you wished to show one of several very large images in the<br />

content window, but didn‘t want the HTML controls to get in the way. You could use the<br />

following main content window (let‘s call it ―imageviewer.html‖), which users would initially load:<br />

File: imageviewer.html<br />

<br />

<br />

<br />

Image Display Window<br />

<br />

<br />

<br />

<br />

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

Saved successfully!

Ooh no, something went wrong!