Suppose we already have a DOM object whose content is as follows:
Content
In JavaScript, we generally need to do this to obtain the title label and text.
VaR Title = Dom. getelementsbytagname ("title ");
Alert (title [0]. nodename); // obtain "title"
When alert (title [0]. nodevalue) is used, FF can only obtain # text, while Ie can only obtain null.
Later, I checked a lot of information. The object text type or object element is also a node.
In the above example, the title is not a simple text content, but a text node.
It also has its own nodename, but it should not be used.
Therefore, it should be written:
Alert (title [0]. firstchild. nodevalue); // obtain the "title"
On the other hand, the create_text_node method is also used to generate a text.
Append_child is also used to add it to a parent node.
It indicates that it is actually a node and requires one more firstchild