Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > [DOM related] IE vs. Gecko

Reply
Thread Tools

[DOM related] IE vs. Gecko

 
 
F. Da Costa
Guest
Posts: n/a
 
      12-11-2003
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") );
}
 
Reply With Quote
 
 
 
 
F. Da Costa
Guest
Posts: n/a
 
      12-11-2003
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") );
> }

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
possible bug in Gecko 1.8 ? false-name@false-account.net Firefox 1 10-11-2005 04:50 PM
Mulitiline Tooltips working in IE, but not in the Gecko based browsers tshad ASP .Net 1 04-04-2005 06:29 PM
khtml or gecko for java Nicholas Smith Java 2 08-20-2003 05:04 PM
Javascript 'history' object unavailable in Mozilla/Gecko/Netscape in strict mode?? Peter Bremer HTML 11 07-30-2003 04:46 PM
Gecko layout engines Samuël van Laere HTML 1 07-23-2003 12:37 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57