"Tim Bücker" <ti***********@ web.de> writes:
(Please don't top post)
Thanks a lot! That was the magic answer - at least my menu is now
working on IE _and_ Opera. Unfortunately Netscape is still a
problem...
Do tell, what is the problem :)
If I am honest, I did not really understand the thing with the text
nodes. Do you perhaps know a good internet resource about that kind
of cross-browser compatibility?
Not really, no, sorry.
About the text nodes:
The DOM (Document Object Model) uses different kinds of DOM "Nodes"
(objects with some basic properties and methods) to represent
different parts of a document. There are, among others, Document
Nodes, Comment Nodes, Element Nodes and Text Nodes. The different
types have more specialized properties and methods than the
abstract Node class.
The code
<div>foo<span>b ar</span>baz</div>
generates one Element Node for the div element. It has three child nodes:
- One text node containing the text "foo".
- One Element node for the span element. It has a text node as child,
containing "bar".
- One text node containing the text "baz".
The difference between browsers here is when two tags appear next to each other
with only whitespace between, e.g.:
<div>
<span>foo</span>
</div>
Between "<div>" and "<span>" is one newline and two spaces. In Mozilla
and Opera, that gives rise to a Text Node with those three characters.
IE doesn't generate Text Nodes for strings containing only whitespace.
Your problem was that getElementsByTa gName is a method of Element Nodes,
not Text Nodes, and the first child element of your node was a text node
in Mozilla/Opera and an element node in IE.
/L
--
Lasse Reichstein Nielsen -
lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
'Faith without judgement merely degrades the spirit divine.'