它不像我不能這樣做,但我只是好奇:爲什麼此代碼崩潰的瀏覽器選項卡?爲什麼這個崩潰瀏覽器選項卡?
var links = document.getElementsByTagName("a");
for (var i = 0; i < links.length; i++) {
var a = document.createElement("A");
a.innerHTML = "[?]";
a.href = links[i].href; //this is the evil line
a.onclick = function() {
return false;
};
links[i].parentNode.appendChild(a);
}