<pre> ia = document.getElementsByClassName("item-name"); le = ia.length; function c(i) { console.log(i) } for (i = 0; i < le; i++) { it = ia[i]; c(it.href); c(it.innerText) } </pre> <a href="https://shop243540206.taobao.com/" target="_blank">告别单身淘宝小店</a>