/

HTML / CSS / JavaScript Tutorial

JavaScript Window method: focus()

[this page | pdf | back links]

The focus() method (when applied to Window objects in the JavaScript BOM) sets focus to the window, which typically brings the window to the foreground (although this may not work as expected in all browsers depending on what settings the user has adopted).

 

It has the following syntax with no parameters. It does not return a value.

 

window.focus(message)

 


NAVIGATION LINKS
Contents | Prev | Next | JavaScript DOM (and BOM)


Desktop view | Switch to Mobile