Insert | client | control
The controls in this article refer to any legitimate HTML tag
Method One:
<div id= "mydiv" ></div>//Container
var strinnerhtml = "<input id=" Myinput "type=" text ">"; The control to add
Docuemnt.all.Form1.myDiv.innerHTML = strinnerhtml; Perform add action
Method Two:
<div id= "mydiv" ></div>//Container
var strinnerhtml = "<input id=" Myinput "type=" text ">"; The control to add
Perform add action
Docuemnt.all.Form1.myDiv.insertAdjacentHTML (' Afterbegin ', strinnerhtml);
The first parameter is the following values:
Afterbegin-Inserts the contents in the front of the text container;
BeforeEnd-Inserts the contents in the container after the text;
Beforebegin-Inserts the contents outside the container before the text;
Afterend-Inserts content outside the text container;
Method Three:
<div id= "mydiv" ></div>//Container
var objnode = document.createelement ("INPUT"); Create an input control
Start specifying control properties
Objnode.type = ' text ';
objnode.id = ' myinput ';
Objnode.value = ' Test ';
Docuemnt.all.Form1.myDiv.insertAdjacentElement ("BeforeEnd", objnode); Perform add action
other control methods for controls:
ChildNodes (index)-Get child controls
Parentelement-Get parent control
Removenode-Deletes the current control