HTMLHyperlinkElementUtils.href

HTMLHyperlinkElementUtils.href 属性是一个包含整个URL的 USVString

Syntax

string = object.href;
object.href = string;

Examples

// Lets imagine an <a id="myAnchor" href="https://developer.mozilla.org/en-US/HTMLHyperlinkElementUtils/href"> element is in the document
var anchor = document.getElementById("myAnchor");
var result = anchor.href; // Returns: 'https://developer.mozilla.org/en-US/HTMLHyperlinkElementUtils/href'

Specifications

Specification Status Comment
HTML Living Standard
HTMLHyperlinkElementUtils.href
Living Standard Initial definition.

Browser compatibility

BCD tables only load in the browser

See also