[thelist] DOM - removeNode() problems

Tom Dell'Aringa pixelmech at yahoo.com
Mon Aug 4 20:39:57 CDT 2003

Hi all,

I'll try to make this as short as possible. The file I am working on
is located at:


I'm displaying form errors using the DOM instead of alerts. I'm able
to write out the errors using appendChild() no problem in both IE and
Gecko/Moz. The problem I run into is with removeNode().

If the user has made an error, I'm setting a global flag to tell my
script he is coming through a 2nd (3rd, 4th etc) time to try again.

In this case, I need to first remove all the old messages, otherwise
I'll get a long list of duplicate messages.

This works fine up to a point. In IE and Moz, the nodes appear to be
removed. IE will even continue after that, not throwing an error. But
the new error messages are never written out again. If I check for
the DIV object I am using to appendChild() the errors to, it returns
as an object (true). This is odd.

In Moz, the second time through it fails giving me the error Error:
errBox.removeNode is not a function. As if either errBox was not
there (according to the DOM inspector it is, and removeNode()
shouldn't remove the actual object its working on) and right before I
attempt it my alert asking for the number of children..

var childLength = errBox.childNodes.length;
var hasNodes = errBox.hasChildNodes;

tells me there are in fact 3 (or whatever) children, so It *should*
be available.

Either there are some DOM issues I am unaware of, or I am doing
something really wrong... any comments are appreciated. All the code
is in the page.

My hope is for this to work across platforms. 

If you have other ideas on how to do this better using other DOM
methods, let me know. The script is a bit messy, I haven't optimized
anything yet.


http://www.pixelmech.com/ :: Web Development Services
http://www.DMXzone.com/ :: Premium Content Author / JavaScript / Every Friday!
http://www.maccaws.com/ :: Group Leader
[Making A Commercial Case for Adopting Web Standards]

"That's not art, that's just annoying." -- Squidward

More information about the thelist mailing list