Client Insert Control

Source: Internet
Author: User
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



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.