The blur()
method removes focus from the current window.
blur |
Yes | Yes | Yes | Yes | Yes |
window.blur()
None.
No return value.
The following code shows how to remove focus from the new window.
<!DOCTYPE html>
<html>
<body>
<button onclick="myFunction()">test</button>
<script>
function myFunction() {<!-- w ww . j a v a2s . co m-->
var myWindow = window.open("", "", "width=200, height=100");
myWindow.document.write("<p>A new window!</p>");
myWindow.blur();
}
</script>
</body>
</html>
The code above is rendered as follows: