SoFunction
Updated on 2025-04-13

Javascript & DHTML DOM Basics and Basic API



2. Dynamic creation and insertion of nodes

1) Create a node object. (tagname), tagname refers to a tag, such as a DIV, which is ("DIV"), which returns a reference to this node.

2) Insert nodes at the tail of the body with (object). For easy understanding, in the following example, I used IE's proprietary attributes to get an HTML tag content (including itself), which makes it easier to see the effect.

[Ctrl+A Select all Note:Introducing external Js requires refreshing the page before execution]

3. Remove nodes.
1)(oChildNode), this is the syntax, see the example below.

[Ctrl+A Select all Note:Introducing external Js requires refreshing the page before execution]

This section will end here. In the next section, we can use these simple APIs to do many things. A few APIs can write many effects.