I have this code, and it returns an error (firebug) on line 26, saying that the variables all_tags is not defined.
I am a little confused about this. Any explanation and help would be appreciated. Thanks in advance. Here is the code:
[CODE]
window.onload = initAll;
function initAll() {
Z.getAllTags();
Z.showNumOfTags();
}
var Z = {
getAllTags: function() {
var all_tags = [];
if (typeof document.all != ‘undefined’) {
all_tags = document.all;
}
else {
all_tags = document.getElementsByTagName(‘*’);
console.debug(all_tags.length);
}
var tag_num = all_tags.length;
console.debug(‘From getAllTags ‘ + tag_num);
},
showNumOfTags: function() {
var num_tags = all_tags.length;
console.debug(‘From showNumOfTags ‘ + num_tags);
}
};
/* And it says ‘all_tags is not defined’ – line 26. */
And just in case, I also posted it [URL=”http://pastebin.com/GfJdztQK”]here.