[DOM related] IE vs. Gecko

Discussion in 'Javascript' started by F. Da Costa, Dec 11, 2003.

  1. F. Da Costa

    F. Da Costa Guest

    Hi,

    In the html (as shown below) there are some <a> tags I need to move into a map.
    This is no problem (in Gecko) using the js below.

    However, IE 5+ (nor 6) does not want to play.
    It gives me an "undefined" error and basically does not give me the objects I expect.

    Undoubtfully one *can* get a hold of these objects and obviously this is the question.
    How does one do this in IE??

    TIA,
    Fermin DCG

    ======================================
    html:
    <table>
    <tr id="1" class="segment">
    <td>
    <div class="tier2">
    <a href="#" class="collapsed" onclick="openCloseSegment(this);"><span class="alt">[-] /</span></a>
    <a href="#" title="Row title">Cat1</a>
    <a href="#" onClick="hideUnhide(this)"><strong>Hide</strong>
    </div>
    </td>
    <td><input type="checkbox" name="checkbox$0" onClick="setCheckbox(this);"/></td>
    <td><input type="text" name="text2Edit$0" value="" align="right"/></td>
    </tr>


    <tr id="1-1" class="segment">
    <td>
    <div class="tier3">
    <a href="#" class="collapsed" onclick="openCloseSegment(this);"><span class="alt">[-] /</span></a>
    <a href="#" title="Row title">Cat1-1</a>
    <a href="#" onClick="hideUnhide(this)"><strong>Hide</strong></a>
    </div> </td>
    <td><input type="checkbox" name="checkbox$1" onClick="setCheckbox(this);"/></td>
    <td><input type="text" name="text2Edit$1" value="" align="right"/></td>
    </tr>
    </table>

    ============================================
    ..js:
    for (var i=0; i < rows.length; i++) {
    r = rows;
    if (r.className=="segment") {
    _segmentRows[r.id]=r;
    r.open="0";
    td = r.childNodes[1]; alert(td.localName);
    div = td.childNodes[1]; alert(div.localName);
    a = div.childNodes[1]; alert(a.localName);

    _row2a[r.id] = a;
    assert("mismatch _row2a[r.id] = a", (_row2a[r.id] == a) && (r.className="segment") );
    }
     
    F. Da Costa, Dec 11, 2003
    #1
    1. Advertising

  2. F. Da Costa

    F. Da Costa Guest

    Re: [DOM related] IE vs. Gecko (SOLVED)

    Solved it myself.
    Works both in IE 5+ as well as Gecko
    F. Da Costa wrote:

    > Hi,
    >
    > In the html (as shown below) there are some <a> tags I need to move into
    > a map.
    > This is no problem (in Gecko) using the js below.
    >
    > However, IE 5+ (nor 6) does not want to play.
    > It gives me an "undefined" error and basically does not give me the
    > objects I expect.
    >
    > Undoubtfully one *can* get a hold of these objects and obviously this is
    > the question.
    > How does one do this in IE??
    >
    > TIA,
    > Fermin DCG
    >
    > ======================================
    > html:
    > <table>
    > <tr id="1" class="segment">
    > <td>
    > <div class="tier2">
    > <a href="#" class="collapsed"
    > onclick="openCloseSegment(this);"><span class="alt">[-] /</span></a>
    > <a href="#" title="Row title">Cat1</a>
    > <a href="#" onClick="hideUnhide(this)"><strong>Hide</strong>
    > </div>
    > </td>
    > <td><input type="checkbox" name="checkbox$0"
    > onClick="setCheckbox(this);"/></td>
    > <td><input type="text" name="text2Edit$0" value="" align="right"/></td>
    > </tr>
    >
    >
    > <tr id="1-1" class="segment">
    > <td>
    > <div class="tier3">
    > <a href="#" class="collapsed"
    > onclick="openCloseSegment(this);"><span class="alt">[-] /</span></a>
    > <a href="#" title="Row title">Cat1-1</a>
    > <a href="#" onClick="hideUnhide(this)"><strong>Hide</strong></a>
    > </div> </td>
    > <td><input type="checkbox" name="checkbox$1"
    > onClick="setCheckbox(this);"/></td>
    > <td><input type="text" name="text2Edit$1" value="" align="right"/></td>
    > </tr>
    > </table>
    >
    > ============================================
    > ..js:
    > for (var i=0; i < rows.length; i++) {
    > r = rows;
    > if (r.className=="segment") {
    > _segmentRows[r.id]=r;
    > r.open="0";

    as = r.getElementsByTagName("a"); a = as[0];
    > td = r.childNodes[1]; alert(td.localName);
    > div = td.childNodes[1]; alert(div.localName);
    > a = div.childNodes[1]; alert(a.localName);
    >
    > _row2a[r.id] = a;
    > assert("mismatch _row2a[r.id] = a", (_row2a[r.id] == a) &&
    > (r.className="segment") );
    > }
     
    F. Da Costa, Dec 11, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. tshad
    Replies:
    1
    Views:
    339
    gaidar
    Apr 4, 2005
  2. Nicholas Smith

    khtml or gecko for java

    Nicholas Smith, Aug 19, 2003, in forum: Java
    Replies:
    2
    Views:
    941
    Nicholas Smith
    Aug 20, 2003
  3. Samuël van Laere

    Gecko layout engines

    Samuël van Laere, Jul 23, 2003, in forum: HTML
    Replies:
    1
    Views:
    409
    David Dorward
    Jul 23, 2003
  4. F. Da Costa
    Replies:
    6
    Views:
    157
    F. Da Costa
    Dec 14, 2003
  5. Luke Matuszewski

    Gecko DOM window onclose event ?

    Luke Matuszewski, Dec 3, 2005, in forum: Javascript
    Replies:
    6
    Views:
    246
    Thomas 'PointedEars' Lahn
    Dec 4, 2005
Loading...

Share This Page