Ajax in some of their own easy to write the wrong code &

Source: Internet
Author: User

1, document.getElementById (' id ') always forget to add the document.

2, document.getElementsByTagName (' tagname ') Similarly, returns the collection of objects with the specified tag name

And this is a getelementsbytagname in the middle of an S, because the return is a collection,

3, Document.createelement (' tr '); Create a TR element

4. If this is the case

<User>
<ID>1</ID>
<username>1</username>
<Password>77</Password>
<Photo>Ddd</Photo>
</User>
<User>
<ID>2</ID>
<username>Huo</username>
<Password>123</Password>
<Photo>Eee</Photo>
</User>

Xml.getelementsbytagname (' user ') [0] represents the first <user> this element

Xml.getelementsbytagname (' user ') [0].childnodes[0] represents the <id> element

Xml.getelementsbytagname (' user ') [0].childnodes[0].childnodes[0] represents a text node

Xml.getelementsbytagname (' user ') [0].childnodes[0].childnodes[0].nodevalue means getting text information

Ajax in some of their own easy to write the wrong code &

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.