• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL

Chapter 5. Working With Browser Windows > Creating a Control Panel

Creating a Control Panel

Using a child window as a control panel—that is, one window that contains controls that affect other windows—opens a world of possibilities in Web site interface design. You can use control panels to assist the ways in which users interact with your site.

To create a control panel:

								newWindow = window.open("cpanel.html", "newWin","width=225,height=200")


The only thing the script in Script 5.10 does is open up a new window (the control panel), using the HTML in the file cpanel.html. You get two windows, as shown in Figure 5.12. Now refer to Script 5.11.

Figure 5.12. The parent window and the child control panel window.

								function updateParent(newURL) {

Now you're working in cpanel.html, which is the code shown in Script 5.11. This line defines the new function updateParent as containing the value of the variable newURL.

Script 5.10. The script sets up the control panel.

Script 5.11. The controlpanel script determines which page will be displayed in the parent window.

								opener.document.location = newURL

This line tells the opener (the parent document) to take its location property (the HTML page it is displaying) from the variable newURL.

								<A HREF="javascript:updateParent ('sample.html')">Sample Chapter</A>


Clicking on the "Sample Chapter" link triggers the updateParent function, and fills newURL with the name of the HTML page sample.html. The parent page obediently loads that page, as seen in Figure 5.13. The rest of the links in the control panel work in the same fashion.

Figure 5.13. Clicking the control panel loads the "Sample Chapter" page in the parent window.



Not a subscriber?

Start A Free Trial

  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint