aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/window/focus/index.html
blob: 984020d0e54a07042d5bc46a33f1e3f7305feed5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
---
title: Window.focus()
slug: Web/API/Window/focus
tags:
  - API
translation_of: Web/API/Window/focus
---
<p>{{APIRef}}</p>

<h2 id="概述">概述</h2>

<p>请求将窗口显示在前(靠近屏幕),这可能由于用户设置而失败,并且该窗口在方法返回之前不能保证会显示在最前.</p>

<h2 id="语法">语法</h2>

<pre class="eval">window.focus()
</pre>

<h2 id="Example" name="Example">示例</h2>

<pre class="eval">if (clicked) { window.focus(); }
</pre>

<h2 id="Specification" name="Specification">规范</h2>

<table class="spectable standard-table">
 <tbody>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Status</th>
   <th scope="col">Comment</th>
  </tr>
  <tr>
   <td>{{SpecName('HTML WHATWG','interaction.html#dom-window-focus','Window.focus()')}}</td>
   <td>{{Spec2('HTML WHATWG')}}</td>
   <td> </td>
  </tr>
 </tbody>
</table>

<p>{{ languages( { "ja": "ja/DOM/window.focus", "pl": "pl/DOM/window.focus" } ) }}</p>