Chapter 9: Handling Events

Return to Chapter 9


To use this script on your own page, click in the text area below, select all, and copy to grab the script. Then, just paste into your own page — and you're done.

Handling Window Events: onfocus

See it run: Handling Window Events: onfocus

Script 9.5

This HTML is for the page that's in back, and that does not have the focus.

Script 9.6

This JavaScript uses the onfocus event handler to control window stacking.

Script 9.7

This HTML is for the page that stays in front, which has the focus.