-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[zh-cn]: update HTMLAnchorElement username property (#16835)
- Loading branch information
1 parent
2802729
commit fe66608
Showing
1 changed file
with
17 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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")}}。 |