Window focus() 方法

定义和用法
focus() 方法将焦点设置到当前窗口,也就是将窗口显示在前(靠近屏幕)。
语法
window.focus()
浏览器支持
Method | |||||
---|---|---|---|---|---|
focus() | Yes | Yes | Yes | Yes | Yes |
实例
实例
确保新窗口获得焦点(发送新窗口前):
function openWin(){
myWindow=window.open('','','width=200,height=100');
myWindow.document.write("<p>这是'我的窗口'</p>");
myWindow.focus();
}
尝试一下 »

更多实例
