HTML and CSS Reference
EXAMPLE 13.6 ( CONTINUED )
11 <body onFocus="focus_on_me()"
// Event handlers
In this example, there are three files involved with frames. This is the HTML file
that defines the frameset. It consists of a main window divided into two frames, a
left frame consisting of 25 percent of the window, and right frame consisting of 75
percent of the window.
The left frame's source code is in a file called leftfocus.html .
The right frame's source code is in a file called rightfocus.html .
This HTML document is the content for the right frame.
The background color of the right frame is lightblue .
This user-defined function, called focus_on_me() , is called when the onFocus
event handler is triggered; that is, when the user's cursor has focus in that window.
hierarchy: parent.left.document.bgcolor .
The status bar in the window is assigned the string “focus leftframe” . Look in the
This user-defined function, called defocus_me , is called when the onBlur event
handler is triggered; that is, when the user's cursor loses focus in that window. It
hierarchy: parent.right.document.bgcolor .
The status bar in the window is assigned the string “focus rightframe” . Look in the sta-
tus bar. (If the status bar doesn't show anything, it could be that the “Hide the status
bar” feature has been enabled for your browser. For Firefox, see Tools
An onFocus event handler is assigned to the <body> tag for the file called leftfo-
cus.html . As soon as focus goes into this window (frame), the handler's function
called focus_on_me() is called.
An onBlur event handler is assigned to the <body> tag for leftfocus.html . When fo-
cus leaves this frame (i.e., the user clicks the mouse in another window), the func-
tion called defocus_me() is called. The output is shown in Figure 13.6.