Handling Window Events: onload
Handling Window Events: onresize
Handling Window Events: onfocus
Handling Window Events: onblur
Mouse Event Handling: onmousedown
Mouse Event Handling: onmousemove
Mouse Event Handling: ondblclick
Form Event Handling: onblur
Form Event Handling: onfocus
Key Event Handling: onkeydown
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.
See it run: Handling Window Events: onfocus
This HTML is for the page that's in back, and that does not have the focus.
This JavaScript uses the onfocus event handler to control window stacking.
This HTML is for the page that stays in front, which has the focus.