Window blur() Method - Javascript Browser Object Model

Javascript examples for Browser Object Model:Window blur

Description

The blur() method removes focus from the current window.

Parameters

None

Return Value

No return value

The following code shows how to Assure that the new window does NOT get focus

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<button onclick="myFunction()">Test</button>

<script>
function myFunction() {/*from   w w w  . j  a va2 s. c om*/
    var myWindow = window.open("", "", "width=200, height=100");
    myWindow.document.write("<p>A new window!</p>");
    myWindow.blur();
}
</script>

</body>
</html>

Related Tutorials