Window blur()Method

Window 对象参考手册Window Object

Definition and Usage

The blur() method removes keyboard focus from the top-level window.

Syntax

window.blur()


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the blur() method, except Opera.


Example

Example

Ensure the new window does not get focus (sends the new window to the background):

<html>
<head>
<script>
function openWin()
{
myWindow=window.open('','','width=200,height=100');
myWindow.document.write("<p>The new window.</p>");
myWindow.blur();
}
</script>
</head>
<body>

<input type="button" value="Open window" onclick="openWin()">

</body>
</html>

Try it Yourself »


实例

More Examples

Ensure the new window gets focus


Window 对象参考手册Window Object Other Extensions