From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- files/zh-cn/web/api/errorevent/index.html | 75 +++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 files/zh-cn/web/api/errorevent/index.html (limited to 'files/zh-cn/web/api/errorevent') diff --git a/files/zh-cn/web/api/errorevent/index.html b/files/zh-cn/web/api/errorevent/index.html new file mode 100644 index 0000000000..963187ef0d --- /dev/null +++ b/files/zh-cn/web/api/errorevent/index.html @@ -0,0 +1,75 @@ +--- +title: ErrorEvent +slug: Web/API/ErrorEvent +tags: + - API + - Event +translation_of: Web/API/ErrorEvent +--- +

{{APIRef("HTML DOM")}}

+ +

ErrorEvent 事件对象在脚本发生错误时产生,它可以提供发生错误的脚本文件的文件名,以及发生错误时所在的行号等信息。

+ +

属性

+ +

除了从 {{domxref("Event")}} 接口继承来的属性外,还有下面这些自身属性。

+ +
+
{{domxref("ErrorEvent.prototype.message")}} {{readonlyInline}}
+
一个{{domxref("DOMString","字符串")}},包含了所发生错误的描述信息。
+
{{domxref("ErrorEvent.prototype.filename")}} {{readonlyInline}}
+
一个 {{domxref("DOMString","字符串")}},包含了发生错误的脚本文件的文件名。
+
{{domxref("ErrorEvent.prototype.lineno")}} {{readonlyInline}}
+
一个数字,包含了错误发生时所在的行号。
+
{{domxref("ErrorEvent.prototype.colno")}} {{readonlyInline}}
+
一个数字,包含了错误发生时所在的列号。
+
{{domxref("ErrorEvent.prototype.error")}} {{readonlyInline}} {{experimental_inline}}
+
发生错误时所抛出的 {{jsxref("Error")}} 对象。
+
+ +

构造函数

+ +
+
{{domxref("ErrorEvent.ErrorEvent", "ErrorEvent()")}}
+
根据传入的参数构造 ErrorEvent 实例。
+
+ +

方法

+ +

除了从 {{domxref("Event")}} 接口继承来的方法外,没有其他方法。

+ +

规范

+ + + + + + + + + + + + + + + + + + + + + +
规范名称规范状态备注
{{ SpecName('HTML WHATWG', 'webappapis.html#the-errorevent-interface', 'ErrorEvent') }}{{ Spec2('HTML WHATWG') }}增加了 error 属性以及其构造函数的第五个参数
{{ SpecName('HTML5 W3C', 'webappapis.html#the-errorevent-interface', 'ErrorEvent') }}{{ Spec2('HTML5 W3C') }}最初规范
+ +

浏览器兼容性

+ + + +

{{Compat("api.ErrorEvent")}}

+ +

相关链接

+ + -- cgit v1.2.3-54-g00ecf