Login Register

getElementsByName on an externally loaded tab on IE

I have a little issue with IE that it's causing me headaches. Any help will be greatly appreciated.

I have the following Widgets in web page:

  • LayoutContainer
    • ContentPane
      • TabContainer
        • and a few LinkPanes loaded
          externaly using the href attribute

I have some parts on the JavaScript code that "uses" regular HTML elements of the Tabs using getElementsByName() or getElementById() - My problem is that everything works with FireFox, but IE doesn't "see" any elements
there.

Do you have some ideas?

--------------

More information: - Here is a simplification of my page layout:

<div dojoType="dijit.layout.LayoutContainer">
        <div dojoType="dijit.layout.ContentPane" layoutAlign="top" tabindex="0">
                Welcome
        </div>
        <div dojoType="dijit.layout.ContentPane" layoutAlign="top" tabindex="0">
                <div id="mainTabContainer" dojoType="dijit.layout.TabContainer">
                        <div id="tab1"  dojoType="dijit.layout.LinkPane" href=\"viewer.php?view=1"></div>
                        <div id="tab2"  dojoType="dijit.layout.LinkPane" href=\"viewer.php?view=2"></div>
                </div>
        </div>
</div>

The "viewer.php" is creating a regular HTML table like this:

<table>
        <tr>
                <td onclick="SelectRow(1)" id=\"cellSubject_1" name="CheatRow">Row content #1</td>
        </tr>
        <tr>
                <td onclick="SelectRow(2)" id=\"cellSubject_2" name="CheatRow">Row content #2</td>
        </tr>
        </table>

And the SelectRow() code that doesn't work on IE contains:

var cheatRow = document.getElementsByName("CheatRow");

cheatRow.length is always 0... As the created tabs were not part of the DOM for IE.

Thanks again,
Omar

It's "getElementsByTagName".

getElementsByName

Well, getElementsByName exists too.

http://developer.mozilla.org/en/docs/DOM:document.getElementsByName

Thanks,
Omar

Try this.

var cheatRow = dojo.query('*[name="CheatRow"]);