IE6 getElementsByTagName not working
I've got this example page where I'm trying to add a child to a "object" tag.
To do it I need to get all the "object > params" in the page. The page I link you works like charm in all the browser except for IE6 (haven't cheked the other IEs yet). With IE6 I can't catch the "params" since document.getElementsByTagName('param') returns an empty object, but this doesn't happen with the "embed"! It won't work with document.getElementsByTagName('object') as well
Here is the page http://dl.dropbox.com/u/4064417/provaJs.html
Any suggestion why it's not returning just the "param" and "object" tags?
If there is no way to make getElementsByTagName, is there any other way I can achieve the same thing in IE6?
Please don't answer telling me that adapting code for IE6 is now a waste of time. I know it, but I have a boss and tasks to follow.
Thank you in advance!
I feel sorry for you, your boss needs to get with the program. I am no longer supporting IE 7 in my code.
Have you tried using "childNodes"? You could then loop through each node to see if it has a "nodeName" of param.
Thank you for your simpathy =\
Unfortunately neither my boss can decide this for he has other bosses as well.
By the way, yeah, I've already tried to loop all the child nodes and got no results. Object and Param tags are skipped. They don't show up
I haven't debugged your particular page, but I can say that it doesn't seem to be an inherent problem, because this works:
My advice would be to start with a minimal example, like above, then start adding code from your page one chunk at a time until you discover the exact piece that's causing things to break down.
<param name="autoplay" value="false">
Thanks to Jeff I found out that removing the <embed> inside the <object> the <param> are counted!
So I guess IE6 wants just <param> inside a <object> tag.
Now the problem is that I don't have control over the pages where my code runs into... so what can I do??
I've tried removing the <embed> child and then call getElementsByTagName("param") but it doesn't like it... it seems that if <object> has other things out of <param> tags it's not loaded into DOM
Last edited by Miroku; 04-01-2012 at 05:06 AM.
It seems that <object> tags (as for instance <a> tags) if not properly written - don't get initialized as elements of the corresponding type. [especially not if the main property/attribute is not present or for some other reason has incorrect syntax or some other coding error.
For instance one might think/expect that <a title="the title" id="theid">this would appear like a hyperlink/ancor element</a> in the document, but it doesn't, - because but it isn't!
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)