当前位置: 动力学知识库 > 问答 > 编程问答 >

javascript - Loop through all attributes of an xml node

问题描述:

Is there a way with JavaScript to loop through all attributes of a given xml node?

I am hoping that there's a simple method that doesn't involve calling a library (jQuery or other).

网友答案:

You can use the attributes collection.

for (var i=0; i<node.attributes.length; i++)
{
    var attrib = node.attributes[i];
}
分享给朋友:
您可能感兴趣的文章:
随机阅读: