JavaScript Window method: blur()
[this page | pdf | back links]
The blur() method (when applied to Window objects
in the JavaScript
BOM) removes focus
from the window.
It
has the following syntax with no parameters. It does not return a value.
window.blur(message)
EXAMPLE:
HTML USED IN THIS EXAMPLE:
<!DOCTYPE html>
<html> <!-- Copyright (c) Nematrian Limited 2018 -->
<head></head>
<body>
try clicking on this button (it should open a new window that does not have focus)<br><br>
<button onclick="myOnclick()">Example</button>
<script>
function myOnclick() {
var newWindow = window.open("","", "width=300, height=300");
newWindow.document.write("<h3>A new window</h3>");
newWindow.blur();
}
</script>
</body>
</html>
|
FUNCTION THAT MAY ASSIST IN TESTING WHETHER FEATURE IS SUPPORTED:
function isSupportedJavaScriptMethodWindowBlur() {
return !!window.blur;
} |
NAVIGATION LINKS
Contents | Prev | Next | JavaScript DOM (and BOM)