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 |
---|
HTML Standard # dom-hyperlink-href-dev |
Browser compatibility
BCD tables only load in the browser
See also
- The
HTMLHyperlinkElementUtils
mixin it belongs to.