137
rated 0 times
[
143]
[
6]
/ answers: 1 / hits: 19172
/ 12 Years ago, tue, march 5, 2013, 12:00:00
var all = document.getElementsByTagName(a);
for (var i=0, max=all.length; i < max; i++) {
alert(x.innerHTML);
}
The purpose of this script is obvious: it tries to loop through all the elements with the tag name a
, and alert the contents of each one.
It doesn't run right.
It works fine, with one element, it alerts it's contents, but when there are more then one, it starts echoing undefined
for each.
More From » javascript