Skip to content

Commit

Permalink
[zh-cn]: update HTMLAnchorElement username property (#16835)
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonren0403 authored Nov 5, 2023
1 parent 2802729 commit fe66608
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions files/zh-cn/web/api/htmlanchorelement/username/index.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,36 @@
---
title: HTMLHyperlinkElementUtils.username
title: HTMLAnchorElement:username 属性
slug: Web/API/HTMLAnchorElement/username
l10n:
sourceCommit: a3d9f61a8990ba7b53bda9748d1f26a9e9810b18
---

{{ApiRef("URL API")}}
{{ApiRef("HTML DOM")}}

**`HTMLHyperlinkElementUtils.username`** 属性是一个 {{domxref("USVString")}}包含域名前面指定的用户名
**`HTMLAnchorElement.username`** 属性是一个字符串,包含在域名之前指定的用户名

## Syntax
##

```plain
string = object.username;
object.username = string;
```
一个字符串。

## 示例

## Examples
### 从锚点链接中获取用户名

```js
// Let's <a id="myAnchor" href="https://anonymous:[email protected]/zh-CN/docs/HTMLHyperlinkElementUtils.username"> be in the document
var anchor = document.getElementByID("myAnchor");
var result = anchor.username; // Returns:'anonymous'
// 假设文档中含有这样的元素:<a id="myAnchor" href="https://anonymous:[email protected]/zh-CN/docs/HTMLAnchorElement">
const anchor = document.getElementByID("myAnchor");
anchor.username; // 返回 'anonymous'
```

## Specifications
## 规范

{{Specifications}}

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

{{Compat}}

## See also
## 参见

- The {{domxref("HTMLHyperlinkElementUtils")}} interface it belongs to.
- 所属接口 {{domxref("HTMLAnchorElement")}}

0 comments on commit fe66608

Please sign in to comment.