These few days reading read these several attributes make a few notesParentNode: As the name implies, it is the parent () that obtains an element that is equal to the JQ.LastChild: Gets the last child element.AppendChild: Adds a child element to the
Write a small system, you need to dynamically add form elements, according to their own way to write this tutorial!
I think you have seen a similar effect on many websites!
1, first use the Document.createelement method to create an INPUT element!
From lcx's blog
In the WEB standard, you can use getElementById (), getElementsByName (), and getElementsByTagName () to access any tag in the DOCUMENT:
1. getElementById ()GetElementById () can access a specific element in the DOCUMENT. As the name
Methods: Target.appendchild (Ele);There are two actions that occur when you execute the method:1. Remove the element ele from the original parent element2. Append the element to the new target element, preserving all style information and events for
The Document.createelement () method, syntax, and usage of the Javascript window object.1. MethodsCreates a new HTML element object and can return an element object, the newly created element object, with the specified label name.2. GrammarThe
When I wrote JS today, I suddenly found that my test page was good under ff, but when I opened it with IE, I always showed the error "ie cannot open XXX page, ended operation, later I found thatProgramThe document. Body. appendchild () Statement is
Create element node: document.createlement (TagName);Create text node: document.createTextNode (text);this is a paragraph.this is another paragraph.New nodevar para=document.createelement ("P");//new elementvar Node=document.createtextnode ("This is
Look at the code
The code is as follows
Copy Code
js practicesimple HTML pagethis is a very simple HTML page.it ' s about as basic as they come. It has: an H1 tagtwo paragraphsan unordered list
Only in Google
The example in this article describes how JavaScript uses appendchild to append nodes. Share to everyone for your reference. The specific analysis is as follows:
The increase in the DOM tree node, the instance code is as follows:
Copy Code
The appendChild method is used to add columns and display the results in the same sequence as the program execution.For details, run the following code:Copy codeThe Code is as follows: name description address
The createelement () function is to create an element in JavaScriptAppendChild () Adding nodes to HTML elementsHere is an example code for post-surfing adaptationsInserting HTML code First Load button Load drop-down box Load this box Example will
Coffee tea click the button to add an item to the list. Personally try Note: First create the Li node, then create the text node and append the text node to the Li node. Finally, add the LI node to the list.
Coffee
Tea
Water
Li Wu:Learn to think more, honouring teachers save Thanksgiving. Leaf See Root 321, rivers with one.Meekness Conscience Lord, willing to do without regrets to the most bitter. Reading exercise strong body and mind, Prudential advised and the line
Using the AppendChild method to add columns, the results are displayed in the same order as the program executes
The following code can be executed in detail:
Copy Code code as follows:
Name
Description
Address
Add data:
Data display:
ClassModel. js source code ::
Copy codeThe Code is as follows: ClassModel =
{
Create: function ()
{
Return function ()
{
This. construct. apply (this, arguments );
}
}
}
Extend = function (desc, src)
{
For (var c in
Javascriptxml reading and writing xml implementation code
Add data:
Data display:
ClassModel. js source code ::
The Code is as follows:
ClassModel ={Create: function (){Return function (){This. construct. apply (this, arguments );}}}Extend =
When processing XML-based applications, developers often need to establish XML-encoded data structures. For example, in the Web, XML status templates based on user input, XML statements for server requests, and customer responses based on runtime
When processing XML-based applications, developers often need to establish XML-encoded data structures. For example, in the Web, XML status templates based on user input, XML statements for server requests, and customer responses based on runtime
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.