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