3 DIV { border:
2px solid khaki; }
9 var it = document.getElementById(
"getid");
11 if (index ==
"") index =
0;
16 var image = document.createElement(
"IMG");
17 image.setAttribute(
"SRC",
"bluedot.gif");
18 image.setAttribute(
"WIDTH",
"100");
19 image.setAttribute(
"HEIGHT",
"40");
20 image.setAttribute(
"BORDER",
"2");
21 image.setAttribute(
"ID",
"obj" + nextID);
27 var block = document.createElement(
"DIV");
28 var text = document.createTextNode(
"Block Text");
29 block.appendChild(text);
30 block.setAttribute(
"ID",
"obj" + nextID);
34 function appendInline()
37 var it = document.getElementById(
"it");
40 function insertInline()
43 var it = document.getElementById(
"it");
44 var kids = it.childNodes;
45 var index = getIndex();
46 if ((index <
0) || (index
> kids.length)) index =
0;
47 var before = kids[index];
48 it.insertBefore(i, before);
50 function appendBlock()
53 var it = document.getElementById(
"it");
56 function insertBlock()
59 var it = document.getElementById(
"it");
60 var kids = it.childNodes;
61 var index = getIndex();
62 if ((index <
0) || (index
> kids.length)) index =
0;
63 var before = kids[index];
64 it.insertBefore(b, before);
68 <INPUT TYPE=button
ONCLICK=
"appendInline();" value=
"Append Inline">
69 <INPUT TYPE=button
ONCLICK=
"insertInline();" value=
"Insert Inline">
70 <INPUT TYPE=button
ONCLICK=
"appendBlock();" value=
"Append Block">
71 <INPUT TYPE=button
ONCLICK=
"insertBlock();" value=
"Insert Block"><BR>
72 <INPUT TYPE=text
value=
"" ID=
"getid">