View Single Post
Old 08-07-2012, 08:04 AM   PM User | #1
sunsin
New to the CF scene

 
Join Date: Aug 2012
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
sunsin is an unknown quantity at this point
xml data in a columns & row not just columns

Hi,
I'm loading xml data in a table which is in a div. I want each item to load in it's own column with only 3 columns per row. I can get the data to load in it's own column but only one column per row. I can also get it to load only three items from the xml file and then goto the next line but then I can't get them to load in columns.

Please help.
Here is my code:

Code:
function displayDOMlist(){
document.getElementById("cat_title").innerHTML="<img src='img/beer_dom_tl.png'>";
  x=xmlDoc.getElementsByTagName("BEER");
  t=document.getElementById("beerlist");
  t.innerHTML="<tr>";
  mltple=1;
  for (i=0;i<x.length;i++){
    naam=(x[i].getElementsByTagName("NAME")[0].childNodes[0].nodeValue);
    info=(x[i].getElementsByTagName("INFO")[0].childNodes[0].nodeValue);
    pic=(x[i].getElementsByTagName("PIC")[0].childNodes[0].nodeValue);
	if (mltple % 3){
		t.innerHTML+="<td width='100'><a href="+pic+">"+naam+"</a></td>";		
    } else {
    t.innerHTML+=naam+"</tr><tr>";
    }
    mltple++;    
  }
sunsin is offline   Reply With Quote