search
HomeBackend DevelopmentPHP TutorialProperties and methods of DOM and XMLHttpRequest objects, domxmlhttprequest_PHP tutorial

Attributes and methods of DOM and XMLHttpRequest objects, domxmlhttprequest

Standard XMLHttpRequest operations

方法

描述

abort()

停止当前请求

getAllResponseHeaders()

把HTTP请求的所有响应的首部作为建/值返回

getResponseHeader(“header”)

返回指定首部的串值

open(String  “method”, String  ”url,

bollean  [asynch],

String  [username],

String  [password])

建立的服务器的调用,method参数可以是post、get或put。url参数可以是相对url或绝对url。这个方法还包括3个可选参数。

send(content)

像服务器发送请求

setRequestHeader(“header”,”value”)

把指定首部设置为所提供的值。在设置任何首部之前必须现调用open().

Method

Description

方法

描述

onreadystatechange

每个状态改变时都会出发这个事件处理器,一般为调用一个javascript函数。

readystate

请求的状态。有5个可取值:

1=未初始化,

2=正在加载,

3=已加载,

4=交互中,

5=完成。

responseText

服务器的响应,表示为一个串。

responseXML

服务器的响应,表示为XML,这个对象一般解析为DOM.

status

服务器HTTP状态码(200对应OK,404对应not found(未找到),等等)

statusText

HTTP状态码的相应文本(OK或not found(未找到)  等等)

abort()

Stop current request

getAllResponseHeaders()

Return the headers of all responses to HTTP requests as build/values

属性名

描述

childNodes

返回当前元素的所有子元素的数组

firstChild

返回当前元素的第一个下级子元素

lastChild

返回当前元素的最后一个子元素

nextSibling

返回紧跟在当前元素后面的元素

Nodevalue

指示表示元素值的读/写属性

parentNode

返回元素的父节点

previousSibling

返回紧邻当前元素之前的元素

getResponseHeader(“header”)
Returns the string value of the specified header
open(String “method”, String “url, bollean [asynch], String [username], String [password]) When calling the established server, the method parameter can be 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 a request to the server
setRequestHeader("header","value") Sets the specified header to the provided value. open(). must be called before setting any headers
Standard XMLHttpRequest attributes

Method

Description

onreadystatechange This event handler will be triggered every time the state changes, usually calling a javascript function.
readystate The status of the request. There are 5 possible values: 1=not initialized, 2=Loading, 3=Loaded, 4=Interacting, 5=Done.
responseText The server's response, expressed as a string.
responseXML The server's response is expressed as XML. This object is generally parsed into DOM.
status Server HTTP status code (200 corresponds to OK, 404 corresponds to not found (not found), etc.)
statusText The corresponding text of the HTTP status code (OK or not found (not found), etc.)
DOM element attributes for processing XML

Attribute name

Description

childNodes Returns an array of all 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 attribute representing the element value
parentNode Returns the parent node of the element
previousSibling Returns the element immediately before the current element

DOM element methods for traversing XML

Method name

方法名

描述

GetElementById(id)  (document)

获取有指定唯一ID属性值文档中的元素

getElementsByTagName(name)

返回当前元素中有指定标记名的子元素的数组

hasChildNodes()

返回一个布尔值,指示元素是否有子元素

getAttribute(name)

返回元素的属性,属性由name指定

Description

GetElementById(id) (document)

Get the element in the document with the specified unique ID attribute value

属性/方法

描述

Docment.createElement(tagName)

文档对象上的createElement方法可以创建有tagname指定的元素。如果以串DIV为参数,就会生成一个DIV元素。

Docment.createTextNode (text)

文档对象上的createTextNode方法会创建一个包含静态文本的节点。

.appendChild(childNode)

appendChild将指定的节点增加到当前节点的子节点列表(作为一个新的子节点)。例如:可以增加一个option元素,做为select元素的子节点。

.getAttribute(name)

这些方法分别设置元素中name属性的值

.getAttribute(name,value)

.insertBefore(newNode,targetNode)

这个方法将节点newNode作为当前元素的子节点插入到targetNode元素的前面

.removeAttribute(name)

这个方法从元素中删除属性name

.removeChild(childNode)

这个方法从元素中删除子元素childNode

.replaceChild(newNode,oldNode)

这个方法将节点newNode替换为oldNode

.hasChildnodes()

这个方法返回一个布尔值,指示元素是否有子元素

 
getElementsByTagName(name)

Returns an array of child elements with the specified tag name in the current element
hasChildNodes() Returns a Boolean value indicating whether the element has child elements
getAttribute(name) Returns the attribute of the element, the attribute is specified by name
W3C DOM properties and methods used when creating content dynamically

Properties/Methods

Description

Docment.createElement(tagName)
The createElement method on the document object can create an element specified by tagname. If the string DIV is used as a parameter, a DIV element will be generated.
Docment.createTextNode (text) The createTextNode method on the document object creates a node containing static text.
.appendChild(childNode) appendChild adds the specified node to the current node's child node list (as a new child node). For example: you can add an option element as a child node of the select element.
.getAttribute(name)

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

.getAttribute(name,value)
.insertBefore(newNode,targetNode) This method inserts the node newNode as a child node of the current element in front of the targetNode element
.removeAttribute(name) This method removes the attribute name from the element
.removeChild(childNode) This method removes the child element childNode from the element
.replaceChild(newNode,oldNode) This method replaces the node newNode with oldNode
.hasChildnodes() This method returns a Boolean value indicating whether the element has child elements ​
http://www.bkjia.com/PHPjc/1102861.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1102861.htmlTechArticleAttributes and methods of DOM and XMLHttpRequest objects, domxmlhttprequest standard XMLHttpRequest operation method description abort() stops the current request getAllResponseHeaders() Put all responses to HTTP requests...
Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
华硕主板与R55600(包括R55600u和5600h)兼容的选择华硕主板与R55600(包括R55600u和5600h)兼容的选择Jan 02, 2024 pm 05:32 PM

R55600搭配华硕哪个主板华硕ROGStrixB550-FGaming主板是一个非常出色的选择。它与Ryzen55600X处理器完美兼容,并提供出色的性能和功能。该主板具备可靠的供电系统,可支持超频,并提供丰富的扩展插槽和端口,满足日常使用和游戏需求。ROGStrixB550-FGaming还配备了高品质的音频解决方案、快速的网络连接和可靠的散热设计,确保系统保持高效稳定。此外,该主板还采用了华丽的ROG风格,配备了华丽的RGB照明效果,为您的计算机增添了视觉享受。总而言之,华硕ROGStri

赛扬g4900与i36100相比哪个更优?(赛扬g4900与i34170相比哪个更优?)赛扬g4900与i36100相比哪个更优?(赛扬g4900与i34170相比哪个更优?)Jan 01, 2024 pm 06:01 PM

赛扬g4900和i36100哪个好当涉及到赛扬G4900和I36100这两款处理器时,毫无疑问,I36100的性能更胜一筹。赛扬处理器通常被视为低端处理器,主要用于廉价笔记本电脑。而I3处理器则主要用于高端处理器,其性能非常出色。不论是玩游戏还是观看视频,使用I3处理器都不会出现任何卡顿情况。因此,如果你有可能,尽量选择购买英特尔I系列处理器,特别是用于台式机,这样你就能畅享网络世界的乐趣了。赛扬G4900T性能怎么样从性能方面来看,奔腾G4900T在频率方面表现出色,相比之前的版本,CPU性能

Vue3获取DOM节点的方式有哪些Vue3获取DOM节点的方式有哪些May 11, 2023 pm 04:55 PM

1.原生js获取DOM节点:document.querySelector(选择器)document.getElementById(id选择器)document.getElementsByClassName(class选择器)....2.vue2中获取当前组件的实例对象:因为每个vue的组件实例上,都包含一个$refs对象,里面存储着对应的DOM元素或组件的引用。所以在默认情况下,组件的$refs指向一个空对象。可以先在组件上加上ref="名字",然后通过this.$refs.

PHP中的DOM操作指南PHP中的DOM操作指南May 21, 2023 pm 04:01 PM

在网页开发中,DOM(DocumentObjectModel)是一个非常重要的概念。它可以让开发者轻松地对一个网页的HTML或XML文档进行修改和操作,比如添加、删除、修改元素等。而PHP中内置的DOM操作库也为开发者提供了丰富的功能,本文将介绍PHP中的DOM操作指南,希望可以帮助到大家。DOM的基本概念DOM是一个跨平台、独立于语言的API,它可以将

vue dom是什么意思啊vue dom是什么意思啊Dec 20, 2022 pm 08:41 PM

dom是一种文档对象模型,同时也是用于html编程的接口,通过dom来操作页面中的元素。DOM是HTML文档的内存中对象表示,它提供了使用JavaScript与网页交互的方式。DOM是节点的层次结构(或树),其中document节点作为根。

vue3中ref绑定dom或组件失败的原因是什么及怎么解决vue3中ref绑定dom或组件失败的原因是什么及怎么解决May 12, 2023 pm 01:28 PM

vue3ref绑定dom或者组件失败原因分析场景描述在vue3中经常用到使用ref绑定组件或者dom元素的情况,很多时候,明明使用ref绑定了相关组件,但是经常ref绑定失败的情况。ref绑定失败情况举例ref绑定失败的绝大多数情况是,在ref和组件绑定的时候,该组件还未渲染,所以绑定失败。或者组件刚开始未渲染,ref未绑定,当组件开始渲染,ref也开始绑定,但是ref和组件并未绑定完成,这个时候使用组件相关的方法就会出现问题。ref绑定的组件使用了v-if,或者他的父组件使用了v-if导致页面

详解Javascript对象的5种循环遍历方法详解Javascript对象的5种循环遍历方法Aug 04, 2022 pm 05:28 PM

Javascript对象如何循环遍历?下面本篇文章给大家详细介绍5种JS对象遍历方法,并浅显对比一下这5种方法,希望对大家有所帮助!

航嘉s980和包豪斯哪个好(航嘉阿波罗和联力包豪斯o11)航嘉s980和包豪斯哪个好(航嘉阿波罗和联力包豪斯o11)Jan 12, 2024 am 11:06 AM

航嘉s980和包豪斯哪个好航嘉(Huntkey)S980和包豪斯(BeQuiet)是两个不同品牌的电脑电源供应器(PSU)制造商。选择哪个更好取决于您的需求和个人偏好得到了消费者的认可和好评。他们的产品广泛应用于个人电脑、服务器、工业设备等领域。航嘉致力于提供高质量的电源产品,不断推出新的技术和创新的设计。他们的产品经过严格的质量控制和测试,确保能够稳定、高效地为设备提供电力。航嘉还注重环保和节能,努力减少对环境的影响。他们的电源供应器符合国际标准,并获得了多项认证和奖项。作为一家信誉良好的品牌

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.