Document.links
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.
语法
nodeList = document.links
返回值
一个 HTMLCollection
。
示例
js
var links = document.links;
for (var i = 0; i < links.length; i++) {
var linkHref = document.createTextNode(links[i].href);
var lineBreak = document.createElement("br");
document.body.appendChild(linkHref);
document.body.appendChild(lineBreak);
}
规范
Specification |
---|
HTML Standard # dom-document-links-dev |
浏览器兼容性
BCD tables only load in the browser