HTMLHyperlinkElementUtils.hash
HTMLHyperlinkElementUtils.hash
属性返回一个包含“#”的 DOMString
, 后跟 URL 的片段标识符。
片段没有百分比解码。如果 URL 没有包含片段标识符,这个属性为一个空的字符串,""
.
Syntax
string = object.hash; object.hash = string;
Examples
// Let's an <a id="myAnchor" href="https://developer.mozilla.org/en-US/docs/HTMLHyperlinkElementUtils.href#youhou"> element be in the document
var anchor = document.getElementById("myAnchor");
var result = anchor.hash; // Returns:'#youhou'
Specifications
Specification |
---|
HTML Standard # dom-hyperlink-hash-dev |
Browser compatibility
BCD tables only load in the browser
See also
- The
HTMLHyperlinkElementUtils
interface it belongs to.