blob: c6037986c3f61f4856af3be39d17fd6c36e914b7 (
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
---
title: Window.alert()
slug: Web/API/Window/alert
tags:
- API
- HTML DOM
- Method
- Reference
- Window
translation_of: Web/API/Window/alert
---
<p>{{APIRef}}</p>
<p><strong><code>Window.alert()</code></strong> 메서드는 확인 버튼을 가지며 메시지를 지정할 수 있는 경고 대화 상자를 띄웁니다.</p>
<h2 id="구문">구문</h2>
<pre class="syntaxbox notranslate">window.alert([<em>message]</em>);</pre>
<h3 id="매개변수">매개변수</h3>
<dl>
<dt><code>message</code> {{optional_inline}}</dt>
<dd>경고 대화 상자에 표시할 텍스트 문자열이거나, 문자열로 변환해 나타낼 객체.</dd>
</dl>
<h2 id="Example" name="Example">예제</h2>
<pre class="brush: js line-numbers language-js notranslate"><code class="language-js">window<span class="punctuation token">.</span><span class="function token">alert</span><span class="punctuation token">(</span><span class="string token">"Hello world!"</span><span class="punctuation token">)</span><span class="punctuation token">;</span>
<span class="function token">alert</span><span class="punctuation token">(</span><span class="string token">"Hello world!"</span><span class="punctuation token">)</span><span class="punctuation token">;</span></code>
</pre>
<p>상기 두 코드의 동작은 모두 다음과 같습니다.</p>
<p><img alt="Image:AlertHelloWorld.png" src="/files/130/AlertHelloWorld.png"></p>
<h2 id="참고">참고</h2>
<p>경고 대화 상자는 사용자의 확인을 제외한 다른 입력을 요구하지 않는 메시지를 전달할 때에 쓰여야 합니다.</p>
<p>대화 상자는 모달 창(부모 창으로 돌아가기 전에 사용자의 상호 작용을 요구하는 자식 창)으로, 사용자는 대화 상자가 닫힐 때까지 다른 모든 인터페이스에 접근할 수 없습니다. 따라서 대화 상자(또는 모달 창)를 만드는 함수를 남용하면 안 됩니다.</p>
<h2 id="명세">명세</h2>
<table class="standard-table">
<tbody>
<tr>
<th scope="col">Specification</th>
<th scope="col">Status</th>
<th scope="col">Comment</th>
</tr>
<tr>
<td>{{SpecName('HTML5 Web application', '#dom-alert', 'alert()')}}</td>
<td>{{Spec2('HTML5 Web application')}}</td>
<td></td>
</tr>
</tbody>
</table>
<h2 id="브라우저_호환성">브라우저 호환성</h2>
<p>{{Compat("api.Window.alert")}}</p>
<h2 id="관련_문서">관련 문서</h2>
<ul>
<li>{{domxref("window.confirm","confirm")}}</li>
<li>{{domxref("window.prompt","prompt")}}</li>
</ul>
|