HTML DOM focus() 方法
定義和用法
focus() 方法可把鍵盤焦點(diǎn)給予一個(gè)窗口。
語法
window.focus()
實(shí)例
下面的例子可確保新的窗口得到焦點(diǎn):
<html>
<body>
<script type="text/javascript">
myWindow=window.open('','','width=200,height=100')
myWindow.document.write("This is 'myWindow'")
myWindow.focus()
</script>
</body>
</html>