Properties and methods for Dom and XMLHttpRequest objects, domxmlhttprequest_php tutorial

Source: Internet
Author: User
Tags tag name tagname

Properties and methods for Dom and XMLHttpRequest objects, domxmlhttprequest


Standard XMLHttpRequest operation

Method

Describe

Abort ()

Stop the current request

getAllResponseHeaders ()

Returns the header of all responses to the HTTP request as a Build/value

getResponseHeader ("header")

Returns the string value of the specified header

Open (String "method", string "url,

Bollean [Asynch],

String [Username],

String [Password])

The invocation of the established server, the method parameter can be a post, get, or put. The URL parameter can be a relative URL or an absolute URL. This method also includes 3 optional parameters.

Send (content)

Send requests like servers

setRequestHeader ("header", "value")

Sets the specified header to the value provided. You must now call open () before setting any headers.

Standard XMLHttpRequest Properties

Method

Describe

onReadyStateChange

Each state is changed to start the event handler, which is typically called a JavaScript function.

ReadyState

The status of the request. There are 5 desirable values:

1= not initialized,

2= is loading,

3= is loaded,

In 4= interaction,

5= completed.

ResponseText

The response of the server, expressed as a string.

Responsexml

The server's response, expressed as XML, is generally parsed as a DOM.

Status

Server HTTP status code (200 corresponds to ok,404 not found (not found), etc.)

StatusText

Corresponding text for the HTTP status code (OK or not found (not found), etc.)

DOM element properties for working with XML

Property name

Describe

ChildNodes

Returns an array of all the child elements of the current element

FirstChild

Returns the first subordinate child element of the current element

LastChild

Returns the last child element of the current element

NextSibling

Returns the element immediately following the current element

NodeValue

Indicates the read/write property that represents the element value

ParentNode

Returns the parent node of the element

PreviousSibling

Returns the element immediately preceding the current element

Dom element method for traversing XML

Method name

Describe

getElementById (ID) (document)

Gets the element that has the specified unique ID property value in the document

getElementsByTagName (name)

Returns an array of child elements in the current element with the specified tag name

HasChildNodes ()

Returns a Boolean value indicating whether the element has child elements

GetAttribute (name)

Returns the attributes of an element, specified by name

The information about DOM properties and methods used when creating content dynamically

Properties/ Method

Describe

Docment. CreateElement (TagName)

The CreateElement method on a Document object can create an element with tagname specified. If a string div is a parameter, a DIV element is generated.

Docment. createTextNode (text)

The createTextNode method on a Document object creates a node that contains static text.

. AppendChild (Childnode)

AppendChild adds the specified node to the list of child nodes of the current node (as a new child node). For example, you can add an option element as a child node of a SELECT element.

. GetAttribute (name)

These methods set the value of the name attribute in the element, respectively

. GetAttribute (Name,value)

. InsertBefore (Newnode,targetnode)

This method inserts the node newnode as a child of the current element into the front of the TargetNode element

. RemoveAttribute (name)

This method removes the attribute from the element name

. RemoveChild (Childnode)

This method removes the child element from the element Childnode

. ReplaceChild (Newnode,oldnode)

This method replaces the node NewNode with the OldNode

. HasChildNodes ()

This method returns a Boolean value that indicates whether the element has child elements

http://www.bkjia.com/PHPjc/1102861.html www.bkjia.com true http://www.bkjia.com/PHPjc/1102861.html techarticle properties and methods of Dom and XMLHttpRequest objects, Domxmlhttprequest standard XMLHttpRequest operation method Description Abort () Stop current request getallresponseheaders () Put all the HTTP requests to the sound ...

  • 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.