ajax应用中很常见的行为便是后台把数据用xml包裹好返回给浏览器,浏览器解析xml,得到nodevalue
如果单个node中内容很长(超过4096字节),这时在firefox/mozilla中就要注意了,内容将会被friefox分解为多个textnode,每个大小为4096字节。这种情况可以用下列函数处理(ie兼容)
复制代码 代码如下:
function getnodevalue(node)
{
if(node && node.haschildnodes()){
//return node.firstchild.nodevalue;
var s=
//mozilla has many textnodes with a size of 4096
//chars each instead of one large one.
//they all need to be concatenated.
for(var j=0;j s+=new string(node.childnodes.item(j).nodevalue);
}
return s;
}else
return ;
}