Skip to content

Commit

Permalink
[zh-cn]: update the translation of Event.returnValue (#23465)
Browse files Browse the repository at this point in the history
Co-authored-by: skyclouds2001 <[email protected]>
Co-authored-by: A1lo <[email protected]>
  • Loading branch information
3 people authored Sep 10, 2024
1 parent e4c1988 commit 4f9202e
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions files/zh-cn/web/api/event/returnvalue/index.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,24 @@
---
title: Event.returnValue
title: EventreturnValue 属性
slug: Web/API/Event/returnValue
l10n:
sourceCommit: d8f04d843dd81ab8cea1cfc0577ae3c5c9b77d5c
---

{{APIRef("DOM")}}{{Deprecated_Header}}
{{APIRef("DOM")}}{{Deprecated_Header}}{{AvailableInWorkers}}

**`Event.returnValue`** 属性表示该事件的默认操作是否已被阻止。默认情况下,它被设置为 `true`,即允许进行默认操作。将该属性设置为 `false` 即可阻止默认操作。
{{domxref("Event")}} 接口的 **`returnValue`** 属性表示该事件的默认操作是否已被阻止。

默认情况下,它被设置为 `true`,即允许进行默认操作。将该属性设置为 `false` 即可阻止默认操作。

> [!NOTE]
> While `returnValue` has been adopted into the DOM standard, it is present primarily to support existing code. You should use {{DOMxRef("Event.preventDefault", "preventDefault()")}}, and {{domxref("Event.defaultPrevented", "defaultPrevented")}} instead of this historical property.
> 虽然 `returnValue` 已被纳入 DOM 标准,但它主要是为了支持现有代码。你应该使用 {{DOMxRef("Event.preventDefault", "preventDefault()")}} {{domxref("Event.defaultPrevented", "defaultPrevented")}} 来代替这个历史遗留属性。
##

A {{domxref("Boolean")}} value which is `true` if the event has not been canceled; otherwise, if the event has been canceled or the default has been prevented, the value is `false`.

The value returned by `returnValue` is the opposite of the value returned by {{domxref("Event.defaultPrevented", "defaultPrevented")}}.

## 使用说明
布尔值,如果事件没有被取消,则为 `true`;否则,如果事件已被取消或默认操作已被阻止,则为 `false`

`returnValue` was introduced into the DOM by Internet Explorer 6, and due to that browser's ubiquity became so commonly used that other browsers eventually implemented it as well. It has been adopted into the DOM specification, primarily to ensure that existing web content continues to function going forward.

New projects should generally avoid using `returnValue`, although they may if they choose to do so.
`returnValue` 的值与 {{domxref("Event.defaultPrevented", "defaultPrevented")}} 返回的值相反。

## 规范

Expand All @@ -29,3 +27,7 @@ New projects should generally avoid using `returnValue`, although they may if th
## 浏览器兼容性

{{Compat}}

## 参见

- {{domxref("HTMLDialogElement.returnValue")}}:{{HTMLElement("dialog")}} 的返回值。

0 comments on commit 4f9202e

Please sign in to comment.