1 //firefox 2 Interface.send(data,function(msg){ 3 $(msg).find("CARINFO").each(function(i){ 4 var obj = $(this).children(); 5 var carlocation = {}; 6 for(var j=0;j<obj.length;j++){ 7 var name = obj[j].nodeName; 8 var textContent=obj[j].textContent; 9 carlocation[name] = textContent; 10 } 11 carlocations.push(carlocation); 12 }); 13 }); 14 15 16 17 //ie 18 $(msg).find("OILWEARINFO").each(function(i){ 19 var obj = $(this).children(); 20 var alarmStat = {}; 21 for(var j=0;j<obj.length;j++){ 22 var name = obj[j].tagName; 23 var textContent=obj[j].text; 24 alarmStat[name] = textContent; 25 } 26 alarmStats.push(alarmStat); 27 }); 28 });
nodeName vs tagName
textContent vs text