473,503 Members | 1,700 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

child nodes array problem in IE7/8

2 New Member
Hello,

I am facing a strange problem. I have written following code.

el.parentNode.parentNode.childNodes[1].style.color="white";

In FireFox and Chrome it works but in IE it gives me following error.

childNodes.1.style is null

I really don't know what is the reason for this error.Can someone please tell me the reason.

Thanks in advance for help.

Regards,
Hiren Dave
Aug 12 '10 #1
2 2837
Dormilich
8,658 Recognized Expert Moderator Expert
standard compliant browsers treat whitespace between tags as a child node (according to the DOM), while IE only counts the element nodes.

Ex
Expand|Select|Wrap|Line Numbers
  1. <parent>
  2. <child/>
  3. </parent>
are 1 child node in IE and 3 child nodes [text node (line break), element node, text node (line break)] in all others.
Aug 12 '10 #2
Hiren Dave
2 New Member
Thanks Dormilich.

It really helped me to solve my problem.
Aug 13 '10 #3

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

Similar topics

13
4133
by: kaeli | last post by:
Can anyone explain this to me? It's driving me insane. Save this and run it in IE or Opera and then in Mozilla or Netscape 6+. In IE/Opera, I get the expected 4 alerts. In Mozilla/Netscape, I...
5
9176
by: Liz | last post by:
C# .NET creating a tree programmatically treeView1.BeginUpdate(); treeView1.Nodes.Clear(); treeView1.Nodes.Add(new TreeNode("Client Details")); tvSelect.Nodes.Add(new TreeNode("Referrals"));...
2
21979
by: Jack | last post by:
Hello, I am trying use a TreeView with checkboxes. I would like to check more than one node and allow all child nodes of selected nodes to be checked or unchecked with the parent is checked. ...
1
2312
by: Daniel Rucareanu | last post by:
Hello, Does anybody knows how can you delete, in just one step, not using a loop, a subset of the child nodes of a given DOM parent node? The subset will be continous, so for example, if the...
14
2000
by: marfi95 | last post by:
I'm trying to iterate through a list of child nodes. It seems like to get the text value of the node, you have to do a node->getFirstChild()->getNodeValue. This being said, there is a...
4
6193
by: javascript | last post by:
I am wondering if it is possible to create a JavaScript function that will re-order child nodes in an Xml Document. Currently I am binding an Xml Data Island to an HTML table and implemented...
3
3534
by: jismon | last post by:
Hi, I have one problem when i'm trying to loop thorugh the child nodes in a XML string in JAVA. The first Loop is working but in the child node there i want to loop and get the values but it doesn't...
2
21794
by: GreggaR0und | last post by:
Hello; I'm trying to iterate through the sub nodes of a child node, but I'm getting a compile error on the nested For...Next expression saying it is invalid. Using the below code, the HasChild()...
2
12815
by: arggg | last post by:
I am trying to add child nodes based on database query in which the users in the database are a part of the parent node. Here is my code. private void GetUsersByGroup() { ...
2
41319
by: Vajrala Narendra | last post by:
Hi, all am using asp.net 2.0, c# i have a tree view control from two tables i have to add nodes dynamically i hav category(cat_id,cat_name), sub category(sub_cat_id,cat_id,sub_cat_name) tables...
0
7201
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,...
0
7083
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7456
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...
1
5011
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
4672
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3153
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1510
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
734
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
379
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.