Name

Window.focus( ) — give keyboard focus to a top-level window

Availability

JavaScript 1.1

Synopsis

                  window.focus(  )

Description

The focus( ) method gives keyboard focus to the top-level browser window specified by the Window object. If the Window object is a frame, keyboard focus is given to the frame and to the top-level window that contains that frame.

On most platforms, a top-level window is brought forward to the top of the window stack when it is given focus.

See Also

Window.blur( )

Get JavaScript: The Definitive Guide, Fourth Edition 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.