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 Location hash property #24798

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
27 changes: 13 additions & 14 deletions files/zh-cn/web/api/location/hash/index.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,34 @@
---
title: "Location: hash"
title: Locationhash 属性
slug: Web/API/Location/hash
l10n:
sourceCommit: a2847ff3788f224ffb4cdf05cb0139e07fde7533
---

{{ APIRef("Location") }}

{{domxref("Location")}} 接口的 **`hash`** 属性返回一个 {{domxref("USVString")}},其中会包含 URL 标识中的 `'#'` 和 后面 URL 片段标识符
{{domxref("Location")}} 接口的 **`hash`** 属性返回一个字符串,其中包含一个 `'#'`,后跟 URL 的片段标识符——URL 试图指向的页面上的 ID

这里 fragment 不会经过[百分比编码](/zh-CN/docs/Glossary/Percent-encoding)(URL 编码)。如果 URL 中没有 fragment,该属性会包含一个空字符串,`""`
该片段标识符没有进行{{Glossary("Percent-encoding", "百分号编码")}}。如果 URL 没有片段标识符,则此属性的值为空字符串 `""`

## Syntax
##

```plain
string = object.hash;
object.hash = string;
```
字符串。

## Examples
## 示例

```html
<a id="myAnchor" href="/zh-CN/docs/Location.href#Examples">Examples</a>
<a id="myAnchor" href="/zh-CN/docs/Location.href#示例">示例</a>
<script>
var anchor = document.getElementById("myAnchor");
console.log(anchor.hash); // 返回'#Examples'
const anchor = document.getElementById("myAnchor");
console.log(anchor.hash); // '#%E7%A4%BA%E4%BE%8B'
</script>
```

## Specifications
## 规范

{{Specifications}}

## Browser compatibility
## 浏览器兼容性

{{Compat}}
Loading