Sunny <su**********@gmail.comwrites:
When I do:
alert(document.getElementsByTagName('*'));
It gives me "Object HTML Collection"
I want to see, all the elements name in my web page.
As I am creating some elements dynamically, i want the name of all the
elements present on my webpage.
And I want to do that in Firefox.
As you might have gathered from previous replies, you
a) need to do something with the collection
b) it isn’t clear from your description what that would be
If you just want a list of the used element types, you’d want to
avoid duplicates and probably sort the result, e.g.
var list = document.getElementsByTagName('*'),
l = list.length,
result = [],
node;
while (l--) {
node = list[l].nodeName;
if (-1 === result.indexOf(node)) {
result.push(node);
}
}
alert(result.sort());
(Joost’s suggestion applies)
--
||| hexadecimal EBB
o-o decimal 3771
--oOo--( )--oOo-- octal 7273
205 goodbye binary 111010111011