我的HTML代码是这样的通过从jQuery的XML节点遍历每个
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript">
if (window.XMLHttpRequest)
{
xmlhttp=new XMLHttpRequest();
} else {
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.open("GET","brands.xml",false);
xmlhttp.send();
theXmlDoc=xmlhttp.responseXML;
function fillForm(){
$(theXmlDoc).find('table[name=brands]').each(function(){
alert($(this));//doesn't fire when brands.xml contains more than one entry of <table name="brands"> else shows Object object
});
我brands.xml是
<table name="brands">
<column name="BrandID">1</column>
<column name="BrandName">AX</column>
<column name="CompanyInfo">FDC</column>
<column name="Composition">Cap</column>
</table>
<table name="brands">
<column name="BrandID">2</column>
<column name="BrandName">UP</column>
<column name="CompanyInfo">Tor</column>
<column name="Composition">Asp</column>
</table>
时brands.xml
包含<table name="brands">
警报的单一条目显示Object对象,但是当我有上面显示的多个表名不会被执行。
有你使用jQuery遍历XML具体原因,但不能找回? – 2012-04-12 12:26:53
我认为jQuery有很多的方法来处理的东西,如果有更好的选择,从HTML访问XML请告诉我,我想要检索的文本,但我只能这样做,一旦我可以从XML节点环 – saum22 2012-04-12 12:39:59