JavaScript Window对象Focus()方法

JavaScript Focus()方法用于在当前打开的窗口上向用户提供焦点。

语法

Window.Focus()

例子

<html>
<head>

  <script type="text/javascript">
	  function myfun() {
		  Win = window.open('', '', 'width=350,height=75');
		  Win.document.write("<h5>新窗口</h5>");

		  Win.focus();
	  }
  </script>
</head>

<body>
  <button onclick="myfun()">点击</button>
</body>

</html>
JavaScript Window对象Focus()方法
日期:2020-04-18 01:09:27 来源:oir作者:oir