How to use Window Object Focus in JavaScript

In this article I am going to explain about Window object Focus() Method in JavaScript.
  • 1336

JavaScript Window Object Focus() Method

JavaScript Focus() method use for focus to the user on the current open window.

Syntax

 

Window.Focus()

Example

<html>

<head>

    <script type="text/javascript">

        function myfun() {

            Win = window.open('', '', 'width=350,height=75');

            Win.document.write("<h5>This is my window</h5>");

            Win.focus();

        }

    </script>

</head>

<body>

    <button onclick="myfun()">

        click me</button>

</body>

</html>

 

Output


focus.gif

 

You may also want to read these related articles: here
 
Ask Your Question 
 
Got a programming related question? You may want to post your question here
 

Categories

More Articles

© 2013 dotNetheaven. All rights reserved.