怎样获取页面中所有带href属性的标签集合

使用: document.links

document.links instanceof HTMLCollection;

注意: 

1. a 标签和 area 标签可以设置 href属性, 因此可以被获取;

2. 返回结果为一个节点集合, 是一个HTMLCollection的实例对象, 它是以类数组对象, 但不能用forEach迭代.

原文地址:https://www.cnblogs.com/aisowe/p/11533240.html