|
HTML DOM focus() Method
Complete Window Object Reference
Definition and Usage
The focus() method sets focus to the current window.
Syntax
Example
The following example assures that the new window gets focus:
<html>
<head>
<script type="text/javascript">
function openWin()
{
myWindow=window.open('','','width=200,height=100');
myWindow.document.write("This is 'myWindow'");
myWindow.focus();
}
</script>
</head>
<body>
<input type="button" value="Open 'myWindow'" onclick="openWin()" />
</body>
</html>
|
|
Try-It-Yourself Demos
Remove focus
from a new window
Complete Window Object Reference
|