Document: thuộc tính links
Baseline
Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since June 2018.
Thuộc tính chỉ đọc links của giao diện Document trả về một bộ sưu tập gồm tất cả các phần tử <area> và <a> trong tài liệu có giá trị cho thuộc tính href.
Giá trị
Một HTMLCollection.
Ví dụ
js
for (const link of document.links) {
const linkHref = document.createTextNode(link.href);
const lineBreak = document.createElement("br");
document.body.appendChild(linkHref);
document.body.appendChild(lineBreak);
}
Đặc tả kỹ thuật
| Specification |
|---|
| HTML> # dom-document-links-dev> |