--- title: HTMLAnchorElement slug: Web/API/HTMLAnchorElement translation_of: Web/API/HTMLAnchorElement ---
HTMLAnchorElement
接口表示超链接元素,并提供一些特别的属性和方法(除了那些继承自普通 {{domxref("HTMLElement")}}对象接口的之外)以用于操作这些元素的布局和显示。
继承其父类 {{domxref("HTMLElement")}} 的属性,并实现 {{domxref("URLUtils")}} 中(定义)的(属性)。
http:
, file:
, data:
or even blob:
(created with {{domxref("URL.createObjectURL")}}).#
'), if any, in the referenced URL.:
'), of the referenced URL.?
'), if any, of the referenced URL.long
containing the position of the element in the tabbing navigation order for the current document.Inherits methods from its parent, {{domxref("HTMLElement")}}, and implements those from {{domxref("URLUtils")}}.
The blur()
and focus()
methods are inherited from {{domxref("HTMLElement")}} from HTML5 on, but were defined on HTMLAnchorElement
in DOM Level 2 HTML and earlier specifications.
Specification | Status | Comment |
---|---|---|
{{SpecName('HTML WHATWG', "text-level-semantics.html#the-a-element", "HTMLAnchorElement")}} | {{Spec2('HTML WHATWG')}} | The following property has been added: download .Technically, the URL-related properties, media , host , hostname , pathname , port , protocol , search , and hash , have been moved to the {{domxref("URLUtils")}} interface, and HTMLAreaElement implements this interface. |
{{SpecName('HTML5 W3C', "text-level-semantics.html#the-a-element", "HTMLAnchorElement")}} | {{Spec2('HTML5 W3C')}} | The methods blur() and focus() , as well as the properties tabindex and accessKey , are now defined on {{domxref("HTMLElement")}}.The following properties are now obsolete: charset , coords , name , rev , and shape .The following properties have been added: hash , host , hostname , media , pathname , port , protocol , relList , search , and text . |
{{SpecName('DOM2 HTML', 'html.html#ID-48250443', 'HTMLAnchorElement')}} | {{Spec2('DOM2 HTML')}} | No change from {{SpecName("DOM1")}}. |
{{SpecName('DOM1', 'level-one-html.html#ID-48250443', 'HTMLAnchorElement')}} | {{Spec2('DOM1')}} | Initial definition. |