HTMLHyperlinkElementUtils.toString()
HTMLHyperlinkElementUtils.toString()
方法返回一个包含整个 URL 的 USVString
。它是HTMLHyperlinkElementUtils.href
的一个只读版本。
句法
string = object.toString();
范例
/*
Let's imagine an
<a id="myAnchor" href="https://developer.mozilla.org/en-US/docs/HTMLHyperlinkElementUtils/toString">
element is in the document
*/
var anchor = document.getElementById("myAnchor");
var result = anchor.toString();
// Returns: 'https://developer.mozilla.org/en-US/docs/HTMLHyperlinkElementUtils/toString'
规范
Specification |
---|
HTML Standard # dom-hyperlink-href-dev |
浏览器兼容性
BCD tables only load in the browser
参见
- The
HTMLHyperlinkElementUtils
mixin it belongs to.