By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,568 Members | 1,196 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,568 IT Pros & Developers. It's quick & easy.

[DOM related] IE vs. Gecko

P: n/a
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
Share this Question
Share on Google+
1 Reply


P: n/a
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.