View Full Version : is child nodes the right choice?

04-19-2006, 03:14 AM
After click a submit button for a javascript quiz I want text that links to a page with the correct answer if the user guess incorrectly to appear. Would using child nodes to change the data in a table be the best course of action?

04-19-2006, 04:48 AM
I suppose so, though your question seems a bit vague.

04-19-2006, 07:49 AM
I would rather use getElementsByTagName() as a subsequent reference instead of childNodes[], as IE and Moz counts in different ways the possible textNodes (the so called "gaps"). Or, if using childNodes or sibling elements, I would check in a while loop is the element I am looking for is a tag or not (on using nodeType).

04-19-2006, 09:05 AM
you can distinguish between text and element nodes using nodeType

1 = element
3 = text node