473,326 Members | 2,061 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

[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 1646
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Raghuram Banda | last post by:
Hi All, Can any one help me how to create a HIDDEN element using JavaScript (DOM) dynamically The following codes works fine with IE but not in Netscape currentElement =...
4
by: Robert | last post by:
Hi, which DOM version (level) should I learn? I've seen that there is a DOM level 3, but is there any support for it already? -- Rob
3
by: Richard Trahan | last post by:
I have read through the Gecko DOM and cannot find properties specific for forms, such as selectedIndex. Where are these properties defined?
1
by: Zhang Weiwu | last post by:
Hello. I often need to write cross-browser javascript, so far gecko dom reference is the reference seems mostly suite me, for things running well on gecko are likely to be running well on other...
2
by: Henri Sivonen | last post by:
In order to keep subsequent code clear, I added a new method like this HTMLDivElement.prototype.foo = function(arg) { // foo for HTML div trees } Element.prototype.foo = function(arg) { //...
6
by: Luke Matuszewski | last post by:
As in topic... has anyone used it ? I tried to use it but i guess i failed... here is a code: <html> <head> <title></title> <script type="text/javascript"> function closedWin() {...
7
by: Luke Matuszewski | last post by:
Hi. I know that it is hard problem (as hard as CSS and HTML layouting rules apply), but maybe someone has some code or idea how to start it. For now i know i will cssQuery: ...
5
by: Chris Lieb | last post by:
I am trying to add an event listener to the keyup event for some text inputs that I am creating dynamically. I have no problems getting it to work in Firefox, but IE just ignores them. I have...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.