CODE
/* Add the Headers */
// Create the Headers Row
var headers = document.createElement("tr");
headers.setAttribute("class", "Compendium");
// Create the Number Header
var number = document.createElement("td");
number.setAttribute("class", "Compendium");
//number.innerHTML = "Number";
number.innerHTML = "Number";
headers.appendChild(number);
// Create the Name Header
var name = document.createElement("td");
name.setAttribute("class", "Compendium");
name.innerHTML = "Name";
headers.appendChild(name);
// Create the Element Header
var element = document.createElement("td");
element.setAttribute("class", "Compendium");
element.innerHTML = "Element";
headers.appendChild(element);
// Create the Expansion Header
var expansion = document.createElement("td");
expansion.setAttribute("class", "Compendium");
element.innerHTML = "Expansion";
headers.appendChild(expansion);
// Create the Card Type Header
var cardtype = document.createElement("td");
cardtype.setAttribute("class", "Compendium");
cardtype.innerHTML = "Card Type";
headers.appendChild(cardtype);
// Create the Primary Type Header
var primarytype = document.createElement("td");
primarytype.setAttribute("class", "Compendium");
primarytype.innerHTML = "Type 1";
headers.appendChild(primarytype);
// Create the Secondary Type Header
var secondarytype = document.createElement("td");
secondarytype.setAttribute("class", "Compendium");
secondarytype.innerHTML = "Type 2";
headers.appendChild(secondarytype);
// Create the Cost Header
var cost = document.createElement("td");
cost.setAttribute("class", "Compendium");
cost.innerHTML = "Cost";
headers.appendChild(cost);
// Create the Cost Header
var actions = document.createElement("td");
actions.setAttribute("class", "Compendium");
actions.innerHTML = "Actions";
headers.appendChild(actions);
// Create the Attack Header
var attack = document.createElement("td");
attack.setAttribute("class", "Compendium");
attack.innerHTML = "Attack";
headers.appendChild(attack);
// Create the Defense Header
var defense = document.createElement("td");
defense.setAttribute("class", "Compendium");
defense.innerHTML = "Defense";
headers.appendChild(defense);
// Create the Move Header
var move = document.createElement("td");
move.setAttribute("class", "Compendium");
move.innerHTML = "Move";
headers.appendChild(move);
// Create the Game Text Header
var gametext = document.createElement("td");
gametext.setAttribute("class", "Compendium");
gametext.innerHTML = "Game Text";
headers.appendChild(gametext);
// Create the Story Text Header
var storytext = document.createElement("td");
storytext.setAttribute("class", "Compendium");
storytext.innerHTML = "Story Text";
headers.appendChild(storytext);
// Create the Rarity Header
var rarity = document.createElement("td");
rarity.setAttribute("class", "Compendium");
rarity.innerHTML = "Rarity";
headers.appendChild(rarity);
// Create the Artist Header
var artist = document.createElement("td");
artist.setAttribute("class", "Compendium");
artist.innerHTML = "Artist";
headers.appendChild(artist);
compendiumResults.appendChild(headers);
// Add Each Card to the Table
for (var index = 0; index < cards.length; ++index) {
// Create the Headers Row
var card = document.createElement("tr");
card.setAttribute("class", "Compendium");
// Create the Number Header
var number = document.createElement("td");
number.setAttribute("class", "Compendium");
if (cards[index].childNodes[0].firstChild) {
number.innerHTML = cards[index].childNodes[0].firstChild.nodeValue;
}
card.appendChild(number);
// Create the Name Header
var name = document.createElement("td");
name.setAttribute("class", "Compendium");
if (cards[index].childNodes[1].firstChild) {
name.innerHTML = cards[index].childNodes[1].firstChild.nodeValue;
}
card.appendChild(name);
// Create the Element Header
var element = document.createElement("td");
element.setAttribute("class", "Compendium");
if (cards[index].childNodes[2].firstChild) {
element.innerHTML = cards[index].childNodes[2].firstChild.nodeValue;
}
card.appendChild(element);
// Create the Expansion Header
var expansion = document.createElement("td");
expansion.setAttribute("class", "Compendium");
if (cards[index].childNodes[3].firstChild) {
expansion.innerHTML = cards[index].childNodes[3].firstChild.nodeValue;
}
card.appendChild(expansion);
// Create the Card Type Header
var cardtype = document.createElement("td");
cardtype.setAttribute("class", "Compendium");
if (cards[index].childNodes[4].firstChild) {
cardtype.innerHTML = cards[index].childNodes[4].firstChild.nodeValue;
}
card.appendChild(cardtype);
// Create the Primary Type Header
var primarytype = document.createElement("td");
primarytype.setAttribute("class", "Compendium");
if (cards[index].childNodes[5].firstChild) {
primarytype.innerHTML = cards[index].childNodes[5].firstChild.nodeValue;
}
card.appendChild(primarytype);
// Create the Secondary Type Header
var secondarytype = document.createElement("td");
secondarytype.setAttribute("class", "Compendium");
if (cards[index].childNodes[6].firstChild) {
secondarytype.innerHTML = cards[index].childNodes[6].firstChild.nodeValue;
}
card.appendChild(secondarytype);
// Create the Cost Header
var cost = document.createElement("td");
cost.setAttribute("class", "Compendium");
if (cards[index].childNodes[7].firstChild) {
cost.innerHTML = cards[index].childNodes[7].firstChild.nodeValue;
}
card.appendChild(cost);
// Create the Cost Header
var actions = document.createElement("td");
actions.setAttribute("class", "Compendium");
if (cards[index].childNodes[8].firstChild) {
actions.innerHTML = cards[index].childNodes[8].firstChild.nodeValue;
}
card.appendChild(actions);
// Create the Attack Header
var attack = document.createElement("td");
attack.setAttribute("class", "Compendium");
if (cards[index].childNodes[9].firstChild) {
attack.innerHTML = cards[index].childNodes[9].firstChild.nodeValue;
}
card.appendChild(attack);
// Create the Defense Header
var defense = document.createElement("td");
defense.setAttribute("class", "Compendium");
if (cards[index].childNodes[10].firstChild) {
defense.innerHTML = cards[index].childNodes[10].firstChild.nodeValue;
}
card.appendChild(defense);
// Create the Move Header
var move = document.createElement("td");
move.setAttribute("class", "Compendium");
if (cards[index].childNodes[11].firstChild) {
move.innerHTML = cards[index].childNodes[11].firstChild.nodeValue;
}
card.appendChild(move);
// Create the Game Text Header
var gametext = document.createElement("td");
gametext.setAttribute("class", "Compendium");
if (cards[index].childNodes[12].firstChild) {
gametext.innerHTML = cards[index].childNodes[12].firstChild.nodeValue;
}
card.appendChild(gametext);
// Create the Story Text Header
var storytext = document.createElement("td");
storytext.setAttribute("class", "Compendium");
if (cards[index].childNodes[13].firstChild) {
storytext.innerHTML = cards[index].childNodes[13].firstChild.nodeValue;
}
card.appendChild(storytext);
// Create the Rarity Header
var rarity = document.createElement("td");
rarity.setAttribute("class", "Compendium");
if (cards[index].childNodes[14].firstChild) {
rarity.innerHTML = cards[index].childNodes[14].firstChild.nodeValue;
}
card.appendChild(rarity);
// Create the Artist Header
var artist = document.createElement("td");
artist.setAttribute("class", "Compendium");
if (cards[index].childNodes[15].firstChild) {
artist.innerHTML = cards[index].childNodes[15].firstChild.nodeValue;
}
card.appendChild(artist);
compendiumResults.appendChild(card);
}
Any ideas would be appreciated.// Create the Headers Row
var headers = document.createElement("tr");
headers.setAttribute("class", "Compendium");
// Create the Number Header
var number = document.createElement("td");
number.setAttribute("class", "Compendium");
//number.innerHTML = "Number";
number.innerHTML = "Number";
headers.appendChild(number);
// Create the Name Header
var name = document.createElement("td");
name.setAttribute("class", "Compendium");
name.innerHTML = "Name";
headers.appendChild(name);
// Create the Element Header
var element = document.createElement("td");
element.setAttribute("class", "Compendium");
element.innerHTML = "Element";
headers.appendChild(element);
// Create the Expansion Header
var expansion = document.createElement("td");
expansion.setAttribute("class", "Compendium");
element.innerHTML = "Expansion";
headers.appendChild(expansion);
// Create the Card Type Header
var cardtype = document.createElement("td");
cardtype.setAttribute("class", "Compendium");
cardtype.innerHTML = "Card Type";
headers.appendChild(cardtype);
// Create the Primary Type Header
var primarytype = document.createElement("td");
primarytype.setAttribute("class", "Compendium");
primarytype.innerHTML = "Type 1";
headers.appendChild(primarytype);
// Create the Secondary Type Header
var secondarytype = document.createElement("td");
secondarytype.setAttribute("class", "Compendium");
secondarytype.innerHTML = "Type 2";
headers.appendChild(secondarytype);
// Create the Cost Header
var cost = document.createElement("td");
cost.setAttribute("class", "Compendium");
cost.innerHTML = "Cost";
headers.appendChild(cost);
// Create the Cost Header
var actions = document.createElement("td");
actions.setAttribute("class", "Compendium");
actions.innerHTML = "Actions";
headers.appendChild(actions);
// Create the Attack Header
var attack = document.createElement("td");
attack.setAttribute("class", "Compendium");
attack.innerHTML = "Attack";
headers.appendChild(attack);
// Create the Defense Header
var defense = document.createElement("td");
defense.setAttribute("class", "Compendium");
defense.innerHTML = "Defense";
headers.appendChild(defense);
// Create the Move Header
var move = document.createElement("td");
move.setAttribute("class", "Compendium");
move.innerHTML = "Move";
headers.appendChild(move);
// Create the Game Text Header
var gametext = document.createElement("td");
gametext.setAttribute("class", "Compendium");
gametext.innerHTML = "Game Text";
headers.appendChild(gametext);
// Create the Story Text Header
var storytext = document.createElement("td");
storytext.setAttribute("class", "Compendium");
storytext.innerHTML = "Story Text";
headers.appendChild(storytext);
// Create the Rarity Header
var rarity = document.createElement("td");
rarity.setAttribute("class", "Compendium");
rarity.innerHTML = "Rarity";
headers.appendChild(rarity);
// Create the Artist Header
var artist = document.createElement("td");
artist.setAttribute("class", "Compendium");
artist.innerHTML = "Artist";
headers.appendChild(artist);
compendiumResults.appendChild(headers);
// Add Each Card to the Table
for (var index = 0; index < cards.length; ++index) {
// Create the Headers Row
var card = document.createElement("tr");
card.setAttribute("class", "Compendium");
// Create the Number Header
var number = document.createElement("td");
number.setAttribute("class", "Compendium");
if (cards[index].childNodes[0].firstChild) {
number.innerHTML = cards[index].childNodes[0].firstChild.nodeValue;
}
card.appendChild(number);
// Create the Name Header
var name = document.createElement("td");
name.setAttribute("class", "Compendium");
if (cards[index].childNodes[1].firstChild) {
name.innerHTML = cards[index].childNodes[1].firstChild.nodeValue;
}
card.appendChild(name);
// Create the Element Header
var element = document.createElement("td");
element.setAttribute("class", "Compendium");
if (cards[index].childNodes[2].firstChild) {
element.innerHTML = cards[index].childNodes[2].firstChild.nodeValue;
}
card.appendChild(element);
// Create the Expansion Header
var expansion = document.createElement("td");
expansion.setAttribute("class", "Compendium");
if (cards[index].childNodes[3].firstChild) {
expansion.innerHTML = cards[index].childNodes[3].firstChild.nodeValue;
}
card.appendChild(expansion);
// Create the Card Type Header
var cardtype = document.createElement("td");
cardtype.setAttribute("class", "Compendium");
if (cards[index].childNodes[4].firstChild) {
cardtype.innerHTML = cards[index].childNodes[4].firstChild.nodeValue;
}
card.appendChild(cardtype);
// Create the Primary Type Header
var primarytype = document.createElement("td");
primarytype.setAttribute("class", "Compendium");
if (cards[index].childNodes[5].firstChild) {
primarytype.innerHTML = cards[index].childNodes[5].firstChild.nodeValue;
}
card.appendChild(primarytype);
// Create the Secondary Type Header
var secondarytype = document.createElement("td");
secondarytype.setAttribute("class", "Compendium");
if (cards[index].childNodes[6].firstChild) {
secondarytype.innerHTML = cards[index].childNodes[6].firstChild.nodeValue;
}
card.appendChild(secondarytype);
// Create the Cost Header
var cost = document.createElement("td");
cost.setAttribute("class", "Compendium");
if (cards[index].childNodes[7].firstChild) {
cost.innerHTML = cards[index].childNodes[7].firstChild.nodeValue;
}
card.appendChild(cost);
// Create the Cost Header
var actions = document.createElement("td");
actions.setAttribute("class", "Compendium");
if (cards[index].childNodes[8].firstChild) {
actions.innerHTML = cards[index].childNodes[8].firstChild.nodeValue;
}
card.appendChild(actions);
// Create the Attack Header
var attack = document.createElement("td");
attack.setAttribute("class", "Compendium");
if (cards[index].childNodes[9].firstChild) {
attack.innerHTML = cards[index].childNodes[9].firstChild.nodeValue;
}
card.appendChild(attack);
// Create the Defense Header
var defense = document.createElement("td");
defense.setAttribute("class", "Compendium");
if (cards[index].childNodes[10].firstChild) {
defense.innerHTML = cards[index].childNodes[10].firstChild.nodeValue;
}
card.appendChild(defense);
// Create the Move Header
var move = document.createElement("td");
move.setAttribute("class", "Compendium");
if (cards[index].childNodes[11].firstChild) {
move.innerHTML = cards[index].childNodes[11].firstChild.nodeValue;
}
card.appendChild(move);
// Create the Game Text Header
var gametext = document.createElement("td");
gametext.setAttribute("class", "Compendium");
if (cards[index].childNodes[12].firstChild) {
gametext.innerHTML = cards[index].childNodes[12].firstChild.nodeValue;
}
card.appendChild(gametext);
// Create the Story Text Header
var storytext = document.createElement("td");
storytext.setAttribute("class", "Compendium");
if (cards[index].childNodes[13].firstChild) {
storytext.innerHTML = cards[index].childNodes[13].firstChild.nodeValue;
}
card.appendChild(storytext);
// Create the Rarity Header
var rarity = document.createElement("td");
rarity.setAttribute("class", "Compendium");
if (cards[index].childNodes[14].firstChild) {
rarity.innerHTML = cards[index].childNodes[14].firstChild.nodeValue;
}
card.appendChild(rarity);
// Create the Artist Header
var artist = document.createElement("td");
artist.setAttribute("class", "Compendium");
if (cards[index].childNodes[15].firstChild) {
artist.innerHTML = cards[index].childNodes[15].firstChild.nodeValue;
}
card.appendChild(artist);
compendiumResults.appendChild(card);
}
Thanks,
~Viz

