www.webdeveloper.com
Results 1 to 6 of 6

Thread: IE6 getElementsByTagName not working

Hybrid View

  1. #1
    Join Date
    Oct 2005
    Posts
    7

    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!

  2. #2
    Join Date
    Jan 2012
    Posts
    31
    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.

  3. #3
    Join Date
    Oct 2005
    Posts
    7
    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

  4. #4
    Join Date
    Jul 2003
    Location
    The City of Roses
    Posts
    2,503
    I haven't debugged your particular page, but I can say that it doesn't seem to be an inherent problem, because this works:

    Code:
    <!doctype html>
    
    <object data="horse.wav">
      <param name="autoplay" value="false">
    </object>
          
    <script>
        alert(document.getElementsByTagName('param').length);
    </script>
    ​
    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.
    for(split(//,'))*))91:+9.*4:1A1+9,1))2*:..)))2*:31.-1)4131)1))2*:3)"'))
    {for(ord){$i+=$_&7;grep(vec($s,$i++,1)=1,1..($_>>3)-4);}}print"$s\n";

  5. #5
    Join Date
    Oct 2005
    Posts
    7
    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??

    EDIT:
    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.

  6. #6
    Join Date
    Jan 2011
    Posts
    123
    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!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles