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
72
73
74
75
76
77
78
79
80
|
---
title: Window.showModalDialog()
slug: Web/API/Window/showModalDialog
translation_of: Web/API/Window/showModalDialog
---
<div>{{ deprecated_header() }}{{APIRef}}</div>
<p> <strong><code>Window.showModalDialog()</code></strong> 用于创建和展示一个指向特定网页的模态对话框。</p>
<h2 id="Syntax" name="Syntax">语法</h2>
<pre class="syntaxbox"><var>returnVal</var> = window.showModalDialog(<var>uri</var>[, <var>arguments</var>][, <var>options</var>]);
</pre>
<p>其中</p>
<ul>
<li><code>returnVal</code> 集合类型(Set)返回值。由<code>uri</code>指定的页面返回。</li>
<li><code>uri</code> 要在模态对话框中打开的页面URI。</li>
<li><code>arguments</code> 可选变量。可以通过该参数将需要的值传入对话框; 参数可以通过 <code><a href="/en-US/docs/DOM/window">window</a></code> 对象的<code><a href="/en-US/docs/DOM/window.dialogArguments">window.dialogArguments</a></code> 属性获取。</li>
<li><code>options</code> 可选字符串参数。用于设置对话框打开的样式,使用一个或多个逗号分隔。</li>
</ul>
<table class="standard-table">
<tbody>
<tr>
<th>Syntax</th>
<th>Description</th>
</tr>
<tr>
<td><code>center: {on | off | yes | no | 1 | 0 }</code></td>
<td>If this argument's value is <code>on</code>, <code>yes</code>, or 1, the dialog window is centered on the desktop; otherwise it's hidden. The default value is <code>yes</code>.</td>
</tr>
<tr>
<td><code>dialogheight: <em>height</em></code></td>
<td>Specifies the height of the dialog box; by default, the size is specified in pixels.</td>
</tr>
<tr>
<td><code>dialogleft: <em>left</em></code></td>
<td>Specifies the horizontal position of the dialog box in relation to the upper-left corner of the desktop.</td>
</tr>
<tr>
<td><code>dialogwidth: <em>width</em></code></td>
<td>Specifies the width of the dialog box; by default, the size is specified in pixels.</td>
</tr>
<tr>
<td><code>dialogtop: <em>top</em></code></td>
<td>Specifies the vertical position of the dialog box in relation to the upper-left corner of the desktop.</td>
</tr>
<tr>
<td><code>resizable: {on | off | yes | no | 1 | 0 }</code></td>
<td>If this argument's value is <code>on</code>, <code>yes</code>, or 1, the dialog window can be resized by the user; otherwise its size is fixed. The default value is <code>no</code>.</td>
</tr>
<tr>
<td><code>scroll: {on | off | yes | no | 1 | 0 }</code></td>
<td>If this argument's value is <code>on</code>, <code>yes</code>, or 1, the dialog window has scroll bars; otherwise its size is fixed. The default value is <code>no</code>.</td>
</tr>
</tbody>
</table>
<p>{{Note("Firefox does not implement the <code>dialogHide</code>, <code>edge</code>, <code>status</code>, or <code>unadorned</code> arguments.")}}</p>
<h2 id="Compatibility" name="Compatibility">Compatibility</h2>
<p>Introduced by Microsoft Internet Explorer 4. Support added to Firefox in Firefox 3 (deprectated in Fx 28), and to Safari in Safari 5.1.</p>
<h2 id="Examples" name="Examples">Examples</h2>
<p><a href="/samples/domref/showModalDialog.html">Try out <code>showModalDialog()</code></a>.</p>
<h2 id="Notes" name="Notes">Notes</h2>
<p><code>showModalDialog()</code> is currently being standardized as part of HTML5. The third argument (for additional options) is not present in the HTML5 version, and is (safely) ignored by both Safari and Chrome.</p>
<h2 id="Specification" name="Specification">Specification</h2>
<ul>
<li><code><a href="https://msdn.microsoft.com/en-us/library/ms536759%28VS.85%29.aspx?f=255&MSPPError=-2147217396">showModalDialog()</a></code></li>
<li><a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/timers.html#dialogs-implemented-using-separate-documents">HTML5 Dialogs implemented using separate documents</a></li>
</ul>
|