Insertbefore Syntax:
Oelement = object. insertbefore (onewnode, ochildnode)
Insert a new node onewnode before the ochildnode and return the reference of the inserted node.
In IE, if ochildnode is omitted, it is used as append onewnode, while in other browsers, it cannot be omitted. Therefore, we should use it as a non-omitted method during programming.
Appendchild Syntax:
Oelement = object. appendchild (onode)
As the identity of the object subnode, onode inserts the last element of the object.
Example:
<Div id = "board"> </div>
<SCRIPT type = "text/JavaScript">
<! --
VaR board = Document. getelementbyid ("Board ");
VaR E = Document. createelement ("input ");
E. type = "radio ";
VaR OBJ = board. appendchild (E );
OBJ. Checked = true;
VaR e2 = Document. createelement ("input ");
E2.type = "checkbox ";
VaR obj2 = board. insertbefore (E2, OBJ );
// The following statement is correct:
// Var obj2 = board. insertbefore (E2, e );
Obj2.checked = false;
-->
</SCRIPT>