473,395 Members | 1,974 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,395 software developers and data experts.

Null error in IE6 with getElementById

Can anyone tell me what is wrong with :-

tNode=document.getElementById("currentStructure"). firstChild;
alert("tNode="+tNode);

In Firefox the alert reports: tNode=[object Text]
In IE6 the alert reports: tNode=null

If I change the code to

tNode=document.getElementById("currentStructure"). childNodes[0];
alert("tNode="+tNode);

which should be exactly the same, Firefox reports as before
but IE6 reports 'undefined'.

Either way IE6 doesn't like it. So what am I doing wrong??
Remove 'no_spam_' from email address.
Skype Free Zone!!
Oct 18 '06 #1
1 3444
Brian A wrote:
Can anyone tell me what is wrong with :-

tNode=document.getElementById("currentStructure"). firstChild;
alert("tNode="+tNode);

In Firefox the alert reports: tNode=[object Text]
In IE6 the alert reports: tNode=null

If I change the code to

tNode=document.getElementById("currentStructure"). childNodes[0];
alert("tNode="+tNode);

which should be exactly the same, Firefox reports as before
but IE6 reports 'undefined'.

Either way IE6 doesn't like it. So what am I doing wrong??
How are we to know what to make of a DOM structure we can't see?
--
Rob

Oct 18 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Gary Mayor | last post by:
Hi, I'm back again. Basically i'm trying to draw a box over an image which is turning out to be a nightmare. The problem i'm getting at the moment is that i'm creating a line with <div which works...
1
by: Leila | last post by:
Folks I have an html file which looks like this: .. .. .. <body onLoad="WindowOnLoad();"> .. ..
21
by: modeep | last post by:
// JavaScript Document var easy = "046280000500600740200000000005032070021000480030170500000000005094001007000096830"; var easySplit = easy.split(''); var eAns =...
3
by: krishnagovindaraj | last post by:
Hi All, I have to display the value in textbox that is selected from dropdownlistbox using ajax.i got the readyState is null or not an object error. coding: <script...
3
gingawarrior
by: gingawarrior | last post by:
Hi All, I've written some code to act as a validator for a set of form fields - it accepts a string of '~' delimited item names and then loops through to evaluate if they are either empty or =='999'...
8
by: ananjy | last post by:
Hi when i m trying to execute my ajax code using a link to display datas from another page named second.php., i got an error when the page loads in "ie"., which runs perfectly in firefox., here...
11
by: CreativeMind | last post by:
hi all, my dropdownlist 'cboUnitTypes' is populating on the base of another dropdownlist1, i have to apply a check on 'cboUnitTypes' like if(cboUnitTypes.value==0)return false; now problem is;...
6
by: cleary1981 | last post by:
I have adapted code from http://dunnbypaul.net/js_mouse/ I want to use a button to create new draggable divs but i keep getting error "is null or not an object" heres the code <html> <head>...
3
by: suganya | last post by:
Hi Some professionals already has developed the project using menu. In my company, they have given me task to clear the error in that. It is a script file named as "menubarAPI4.js" which is kept...
2
by: vegetable21 | last post by:
Hi, I'm relatively new to JavaScript, but not to programming. I'm trying to get a table to expand and collapse within a cell of my master table. However i want to collapse all the other open...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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
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
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,...

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.