1

The below code works in IE but not in other browsers.

var node = xmlHttp.responseXML.documentElement;
var eitems = node.getElementsByTagName("nib:ProcessRequestResponse");
txt = eitems.context.text;
txt2 = txt.replace("\n", "");

Gives error "eitems.context is undefined". I have also tried eitems.context.textContent, eitems.context.innertext, eitems.context.innerHTML. All gives same error.

4

2 回答 2

0

我曾经txt = node.textContent获取标签的内容并且它有效

于 2021-12-16T13:49:10.107 回答
0

getElementsByTagName()返回一个 HTMLCollection。访问第一个元素

 var item = eitems.item(0);

要不就

 var item = eitems[0];

用于item获取内容。

于 2021-09-16T14:58:20.740 回答