Frame.onFocus

JavaScript 1.1+, JScript 1.0+ Nav3+, IE 3+, Opera3+ Syntax

onFocus="command"

Description

The onFocus event handler is used to specify when the focus is brought to a frame. The user can set the focus by either pressing the mouse button or by using the Tab key.

Example

The syntax for accessing the onFocus event handler is shown in Listing 7.278. When the focus is set on the top frame, an alert box is displayed.

Listing 7.278 Syntax for the onFocus Event Handler
<html>
<title> Example of onFocus event handler of the Frame object</title>

<frameset rows="80, *">
<frame src=top.html name=top onFocus='alert("You are now in the top frame")'>
<frame src=bottom.html name=bottom>
</frameset>

</html>
							
						

Get Pure JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.