HTML DOM Dialog object

Dialog 对象

Dialog 对象是 HTML5 中的新对象。

Dialog 对象表示 HTML <dialog> 元素。

注释:目前只有 Chrome Canary 和 Safari 6 支持 <dialog> 元素。

访问 Dialog 对象

您可以通过使用 getElementById() 来访问 <dialog> 元素:

var x = document.getElementById("myDialog");

亲自试一试

创建 Dialog 对象

您可以通过使用 document.createElement() 方法来创建 <dialog> 元素:

var x = document.createElement("DIALOG");

亲自试一试

Dialog 对象属性

Properties 描述
open 设置或返回对话是否是打开的。
returnValue 设置或返回对话的返回值。

Dialog 对象方法

方法 描述
close() 关闭对话。
show() 显示对话。
showModal() Display the dialog and make it the top-most dialog.

Standard properties and events

Dialog object supports standardsPropertiesandEvents.

Related pages

HTML reference manual:HTML <dialog> tag