473,513 Members | 2,377 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

IE and Mozilla .. DOM parsing.

dmjpro
2,476 Top Contributor
Have a look at my HTML code...

Expand|Select|Wrap|Line Numbers
  1. <TD some..attributes ..... id="my_TD">
  2.  <TABLE ... >
  3.  .
  4.  .
  5.  </TABLE>
  6. </TD>
  7.  
Now see what i am getting in Mozilla 2.0 and IE 6.0
Expand|Select|Wrap|Line Numbers
  1. alert(document.getElementById('my_ID').childNodes.length);
  2.  
In Mozilla it shows 2 (it's ovious, first child is textNode and next child is "TABLE"), but in IE it shows 1 .. only the child "TABLE".
How do i solve this?
Apr 23 '09 #1
4 1661
Dormilich
8,658 Recognized Expert Moderator Expert
I don't think, you can solve it, but does it really matter? (well, depending on what you do)

btw. IE's DOM implementation is not the best…
Apr 23 '09 #2
dmjpro
2,476 Top Contributor
@Dormilich
hmmm :P
Well so to access the "Table" what would be the generalized code? ;)

Expand|Select|Wrap|Line Numbers
  1. tabChild = parentNode.childNodes[0].tagName && parentNode.childNodes[0].tagName=='table'?parentNode.childNodes[0]:parentNode.childNodes[1];
  2.  
S***, IE is so hell :(
Apr 23 '09 #3
Dormilich
8,658 Recognized Expert Moderator Expert
Expand|Select|Wrap|Line Numbers
  1. document.getElementById("my_TD").getElementsByTagName("table")[0];
Apr 23 '09 #4
dmjpro
2,476 Top Contributor
@Dormilich
Yeah that's good, Actually i always have been using "document.getElementsByTagName", but it can be with any element to find out the childNodes ;)
2 3 days earlier i read the MDC document there i saw it, but could not apply it here.
Thanks !
Apr 23 '09 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

6
1992
by: Walter Dörwald | last post by:
Hello all! I'm trying to parse broken HTML with several Python tools. Unfortunately none of them work 100% reliable. Problems are e.g. nested comments, bare "&" in URLs and "<" in text (e.g....
1
2457
by: Greg | last post by:
The following code works fine on Mozilla but generates an error* on IE, when the button calling the function is pressed and the slideshow is either on the first slide or last slide. * I can't...
4
2894
by: andres obrero | last post by:
i want to resize dynamically table cols. But some strange behaviour occurs under mozilla. I cannot resize a col smaller than the largest element, even with overflow hidden and table-layout fixed....
1
1943
by: mr_burns | last post by:
Hi there, I am using the following function to import a xml file whether the users browser be IE or Mozilla: function importXML(file) { var xmlDoc; var moz = (typeof document.implementation...
2
1334
by: mlybarger | last post by:
we currently have a heavy dataisland based site and would like to get it working on mozilla to take advantage of the js debuggers and other various tools. there have been various issues along...
6
2758
by: Thomas | last post by:
In Mozilla: The problem we are trying to solve: We are using XSL/XML to generate tables with text in the rows. The spacing is wider then when those same exact tables are created in regular HTML....
1
1827
by: DaveG | last post by:
Hi All I am having a small problem with window.open() obviously something I am or am not doing. This is being fired from a subwindow. Everytime I use just the location.href = "URL" I got a...
2
4143
by: ErkA | last post by:
Hello sorry of omy pure english ;) I think, that something wrong is in mozilla *FF 1,5,0,2* I'm trying to parse a xml file http://bazarek.pl/txt/note.xml by XMLHttpRequest method. In IE,...
4
2525
RamananKalirajan
by: RamananKalirajan | last post by:
Hi All, I am using Ajax inorder to retrieve a data from the db which is an xml and i am parsing the responseText into an xml. the code what i had tried is working well with IE, but the...
0
7269
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
1
7123
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7542
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5701
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5100
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3248
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3237
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
811
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
470
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.