469,949 Members | 2,430 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,949 developers. It's quick & easy.

[DOM related] IE vs. Gecko

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[i];
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") );
}
Jul 20 '05 #1
1 1565
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[i];
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") );
}

Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Raghuram Banda | last post: by
4 posts views Thread by Robert | last post: by
3 posts views Thread by Richard Trahan | last post: by
1 post views Thread by Zhang Weiwu | last post: by
2 posts views Thread by Henri Sivonen | last post: by
6 posts views Thread by Luke Matuszewski | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.