Method 1,
<SCRIPT>
Function addnode (name, size, picpath, ID)
{
VaR S = Document. createelement ('span ');
S. innerhtml = '<Div id = skirt01 style = "Z-INDEX: 2; left: 375px; width: 60px; position: absolute; top: 455px; height: 67px "> <a ondblclick =" mm_timelinegoto (\ 'skirt01 \ ', \ '10 \') "> 'Skirt1w \ ', \', \ 'Show \ ') "onclick =" mm_timelinegoto (\ 'skirt01 \', \ '5 \') "onmouseout =" mm_showhidelayers (\ 'skirt1w \ ', \', \ 'hide \') "Height = 150 src =" 1.jpg "width = 107 border = 0> </a> </div> ';
Document. Body. appendchild (s );
}
</SCRIPT>
Method 2: it is a little troublesome. Each parent and child control must be appendchild once.
<SCRIPT>
Function addnode (name, size, picpath, ID)
{
VaR myelement = Document. createelement ('lil ');
Myelement. style. width = "150px ";
Myelement. style. Height = "324px ";
Document. getelementbyid ("imgid"). appendchild (myelement );
// Div
VaR div1 = Document. createelement ('div ');
Div1.id = "themeid ";
Div1.style. width = "150px ";
Div1.style. Height = "300px ";
Myelement. appendchild (div1 );
VaR span1 = Document. createelement ('span ');
Span1.classname = "cap_td ";
Span1.style. Height = "24px ";
Span1.title = Name; // The prompt after you place the cursor over it
Span1.innerhtml = Name;
Div1.appendchild (span1 );
VaR br1 = Document. createelement ('br ');
Div1.appendchild (br1 );
VaR span2 = Document. createelement ('span ');
Span2.classname = "wgt_td ";
Span2.style. Height = "24px ";
Span2.innerhtml = size; // the size of the topic package
Div1.appendchild (span2 );
VaR img1 = Document. createelement ('img ');
Img1.classname = "imgshow ";
Img1.src = picpath; // preview the image path
Img1.title = "New Topic image"; // The topic details are displayed here.
Img1.id = ID; // ID
Img1.onmousedown = function ()
{
Alert ("clinkmousebtndown ");
If (event. Button = 1)
{
Select_when_left_mousekey_down (ID );
External. onlbottondownfunc ();
}
}
Div1.appendchild (img1 );
// Check box
VaR chkbox = Document. createelement ('input ');
Chkbox. type = "checkbox ";
Chkbox. style. Height = "24px ";
Chkbox. ID = ID;
Chkbox. classname = "checkbox_cls ";
Myelement. appendchild (chkbox );
}
</SCRIPT>