HTMLHyperlinkElementUtils.toString()
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
io error: No such file or directory (os error 2) (/home/runner/work/yari/yari/mdn/translated-content/files/zh-cn/web/api/htmlanchorelement/index.md)
HTMLHyperlinkElementUtils.toString()
方法返回一个包含整个 URL 的 USVString
。它是HTMLHyperlinkElementUtils.href
的一个只读版本。
句法
string = object.toString();
范例
js
/*
Let's imagine an
<a id="myAnchor" href="https://developer.mozilla.org/zh-CN/docs/HTMLHyperlinkElementUtils/toString">
element is in the document
*/
var anchor = document.getElementById("myAnchor");
var result = anchor.toString();
// Returns: 'https://developer.mozilla.org/zh-CN/docs/HTMLHyperlinkElementUtils/toString'
规范
Specification |
---|
HTML Standard # dom-hyperlink-href-dev |
浏览器兼容性
BCD tables only load in the browser
参见
- The
HTMLHyperlinkElementUtils
mixin it belongs to.