我试图了解 querySelectorAll 是如何工作的,因为我有一些问题要让这段代码在 IE8 中工作。
有什么想法可以解决吗?问候
function leaving_site() {
return confirm("Do you really want to leave site?");
}
function changeValue() { // Larger Image
window.open(this.src.replace(/\.jpg/, "big.jpg"));
}
function init(){
var external = document.getElementsByClassName("external"); // Leaving site
for (var i = 0; i < external.length; i++) {
external[i].onclick = leaving_site;
}
var bild = document.getElementsByClassName("picture"); // Larger Image
for (var i = 0; i < picture.length; i++) {
picture[i].onclick = changeValue;
}
}
window.onload = init;