Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zh-cn: update the translation of HTMLBodyElement #16782

Merged
merged 1 commit into from
Oct 31, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 41 additions & 38 deletions files/zh-cn/web/api/htmlbodyelement/index.md
Original file line number Diff line number Diff line change
@@ -1,78 +1,81 @@
---
title: HTMLBodyElement
slug: Web/API/HTMLBodyElement
l10n:
sourceCommit: 387d0d4d8690c0d2c9db1b85eae28ffea0f3ac1f
---

{{APIRef("HTML DOM")}}
**`HTMLBodyElement`** 接口提供了特殊的属性(除了它们继承的常规的{{ domxref("HTMLElement") }}接口)以外,还可以处理 body 元素。

{{InheritanceDiagram(600, 120)}}
**`HTMLBodyElement`** 接口提供了用于操作 {{HtmlElement("body")}} 元素的特定属性(除继承自 {{domxref("HTMLElement")}} 接口的属性以外)。

## 属性
{{InheritanceDiagram}}

_从其父项{{domxref("HTMLElement")}} 中继承属性。_
## 实例属性

- {{domxref("HTMLBodyElement.aLink")}} {{Deprecated_Inline}}
- : Is a {{ domxref("DOMString") }} that represents the color of active hyperlinks.
- {{domxref("HTMLBodyElement.background")}} {{Deprecated_Inline}}
- : Is a {{ domxref("DOMString") }} that represents the description of the location of the background image resource. Note that this is not an URI, though some older version of some browsers do expect it.
- {{domxref("HTMLBodyElement.bgColor")}} {{Deprecated_Inline}}
- : Is a {{ domxref("DOMString") }} that represents the background color for the document.
- {{domxref("HTMLBodyElement.link")}} {{Deprecated_Inline}}
- : Is a {{ domxref("DOMString") }} that represents the color of unvisited links.
- {{domxref("HTMLBodyElement.text")}} {{Deprecated_Inline}}
- : Is a {{ domxref("DOMString") }} that represents the foreground color of text.
- {{domxref("HTMLBodyElement.vLink")}} {{Deprecated_Inline}}
- : Is a {{ domxref("DOMString") }} that represents the color of visited links.
_从其父接口 {{domxref("HTMLElement")}} 继承属性。_

## 方法
- {{domxref("HTMLBodyElement.aLink")}} {{deprecated_inline}}
- : 一个表示活动链接颜色的字符串。
- {{domxref("HTMLBodyElement.background")}} {{deprecated_inline}}
- : 一个表示背景图片资源位置的字符串。注意,这不是 URI,尽管一些旧版浏览器可能会期望它是。
- {{domxref("HTMLBodyElement.bgColor")}} {{deprecated_inline}}
- : 一个表示文档背景颜色的字符串。
- {{domxref("HTMLBodyElement.link")}} {{deprecated_inline}}
- : 一个表示未访问链接颜色的字符串。
- {{domxref("HTMLBodyElement.text")}} {{deprecated_inline}}
- : 一个表示文本前景色的字符串。
- {{domxref("HTMLBodyElement.vLink")}} {{deprecated_inline}}
- : 一个表示已访问链接颜色的字符串。

_No specific methods; inherits methods from its parent, {{domxref("HTMLElement")}}_.
## 实例方法

_无特定方法;从其父接口 {{domxref("HTMLElement")}} 继承方法。_

## 事件处理器

继承了 {{domxref("HTMLElement")}} 的事件
{{domxref("HTMLElement")}} 继承事件

以下以 {{domxref("Window")}} 为目标的 `onXYZ` 事件处理器属性同样在 `window` 对象这一别名目标上可用。但建议直接在 `window` 对象上监听这些事件,而不是在 `HTMLBodyElement` 上。

> **备注:** 对于以下的 `onXYZ` 事件处理器,在 `HTMLBodyElement` 上使用 `addEventListener()` 将不会生效。请在 {{domxref("window")}} 对象上监听这些事件。

- {{domxref("window.afterprint_event", "HTMLBodyElement.onafterprint")}}
- : Fired after the associated document has started printing or the print preview has been closed.
- : 在关联的文档开始打印或打印预览关闭后触发。
- {{domxref("window.beforeprint_event", "HTMLBodyElement.onbeforeprint")}}
- : Fired when the associated document is about to be printed or previewed for printing.
- : 在关联的文档即将打印或预览打印时触发。
- {{domxref("window.beforeunload_event", "HTMLBodyElement.onbeforeunload")}}
- : Fired when the window, the document and its resources are about to be unloaded.
- : 在窗口、文档及其资源即将被卸载时触发。
- {{domxref("window.gamepadconnected_event", "HTMLBodyElement.ongamepadconnected")}}
- : Fired when the browser detects that a gamepad has been connected or the first time a button/axis of the gamepad is used.
- : 在浏览器检测到游戏手柄已连接或首次使用游戏手柄的按钮/轴时触发。
- {{domxref("window.gamepaddisconnected_event", "HTMLBodyElement.ongamepaddisconnected")}}
- : Fired when the browser detects that a gamepad has been disconnected.
- : 在浏览器检测到游戏手柄已断开连接时触发。
- {{domxref("window.hashchange_event", "HTMLBodyElement.onhashchange")}}
- : Fired when the fragment identifier of the URL has changed (the part of the URL beginning with and following the `#` symbol).
- : URL 的片段标识符(URL 中以 `#` 符号开头和紧跟的部分)发生变化时触发。
- {{domxref("window.languagechange_event", "HTMLBodyElement.onlanguagechange")}}
- : Fired when the user's preferred language changes.
- : 在用户首选语言发生变更时触发。
- {{domxref("window.message_event", "HTMLBodyElement.onmessage")}}
- : Fired when the window receives a message, for example from a call to [`Window.postMessage()`](/zh-CN/docs/Web/API/Window/postMessage) from another browsing context.
- : 在窗口接收到消息时触发,例如来自另一个浏览上下文的 [`Window.postMessage()`](/zh-CN/docs/Web/API/Window/postMessage) 调用。
- {{domxref("window.messageerror_event", "HTMLBodyElement.onmessageerror")}}
- : Fired when the window receives a message that can't be deserialized.
- : 在窗口接收到无法反序列化的消息时触发。
- {{domxref("window.offline_event", "HTMLBodyElement.onoffline")}}
- : Fired when the browser has lost access to the network and the value of {{domxref("Navigator.onLine")}} switches to `false`.
- : 在浏览器失去网络连接且 {{domxref("Navigator.onLine")}} 的值变为 `false` 时触发。
- {{domxref("window.online_event", "HTMLBodyElement.ononline")}}
- : Fired when the browser has gained access to the network and the value of {{domxref("Navigator.onLine")}} switches to `true`.
- : 在浏览器获得网络连接且 {{domxref("Navigator.onLine")}} 的值变为 `true` 时触发。
- {{domxref("window.pagehide_event", "HTMLBodyElement.onpagehide")}}
- : Fired when the browser hides the current page in the process of presenting a different page from the session's history.
- : 在浏览器在呈现会话历史中的不同页面而隐藏当前页面时触发。
- {{domxref("window.pageshow_event", "HTMLBodyElement.onpageshow")}}
- : Fired when the browser displays the window's document due to navigation.
- : 在浏览器由于导航而显示窗口的文档时触发。
- {{domxref("window.popstate_event", "HTMLBodyElement.onpopstate")}}
- : Fired when the active history entry changes while the user navigates the session history.
- : 在用户导航会话历史而使活动历史条目发生变化时触发。
- {{domxref("window.rejectionhandled_event", "HTMLBodyElement.onrejectionhandled")}}
- : Fired whenever a JavaScript {{jsxref("Promise")}} is rejected and the rejection has been handled.
- : JavaScript {{jsxref("Promise")}} 被拒绝且拒绝已被处理时触发。
- {{domxref("window.storage_event", "HTMLBodyElement.onstorage")}}
- : Fired when a storage area (`localStorage`) has been modified in the context of another document.
- : 在另一个文档的上下文中修改存储区(`localStorage`)时触发。
- {{domxref("window.unhandledrejection_event", "HTMLBodyElement.onunhandledrejection")}}
- : Fired whenever a {{jsxref("Promise")}} is rejected but the rejection was not handled.
- : 在 JavaScript {{jsxref("Promise")}} 被拒绝且拒绝未被处理时触发。
- {{domxref("window.unload_event", "HTMLBodyElement.onunload")}}
- : Fired when the document is being unloaded.
- : 在文档被卸载时触发。

## 规范

Expand All @@ -84,4 +87,4 @@ _No specific methods; inherits methods from its parent, {{domxref("HTMLElement")

## 参见

- HTML 元素实现了这个接口:{{ HTMLElement("body") }}
- 实现了此接口的 HTML 元素:{{ HTMLElement("body") }}