Jump to content

For Loop Crashes...I Really Need Your Help!


Tundra

Recommended Posts

I have heard this is a problem:Actually, Im not really sure I should even have to use a for loop since im pulling from different xml documents.BUT, when the loop hits an element that is null eg. <playerLeaderboard /> it stops document.write in my script.Once it reaches the <playerLeaderboard> element on player 188890 it stops everything. I want it to return a value of 'unranked' for that element and then continue on writing in the cells.Here is my giant code:

<html><head><style type="text/css">table.roster {	border: 0; cellpadding: 5; cellspacing: 1; background-color: #000000; text-align: center; font-size:11px; font-family:verdana;}table.roster td.01 {	width: 40px; }table.roster td.02 {	width: 75px;}table.roster td.03 {	width: 80px;}table.roster tr.d1 {	background-color: #999999; color: black;}table.roster tr.d2 {	background-color: #cccccc; color: black;}</style></head><body><!--**********Start Column Header Table**********--><table class="roster">	<tr class="d2">		<td class="02">Callsign</td>		<td class="01">Rank</td>		<td class="01">Global</td>		<td class="01">Air</td>		<td class="01">Arm</td>		<td class="01">Inf</td>		<td class="01">Sup</td>		<td class="03">Last Played</td>		<td class="02">Total Score</td>		<td class="01">K</td>		<td class="01">D</td>	</tr></table><!--**********End Column Header Table**********--><!--XML Script NotesScript is Copyright 2008 Corey Dobbs (saturn_command@hotmail.com)You may use this code for free, just please keep these notes intactI am self taught and I know this code can be improved upon, please email me with any improvements!End XML Notes--><!--********************--><script type="text/javascript">var xmlDoc=null;if (window.ActiveXObject){// code for IExmlDoc=new ActiveXObject("Microsoft.XMLDOM");}else if (document.implementation.createDocument){// code for Mozilla, Firefox, Opera, etc.xmlDoc=document.implementation.createDocument("","",null);}else{alert('Your browser cannot handle this script');}<!--********************--><!--Start Leader--><!--********************-->if (xmlDoc!=null){xmlDoc.async=false;xmlDoc.load("http://www.massgate.net/xml-player.php?id=336482");document.write("<table class='roster'>");var x=xmlDoc.getElementsByTagName("player");for (i=0;i<x.length;i++){ document.write("<tr class='d1'>");document.write("<td class='02'>");document.write(x[i].getElementsByTagName("name")[0].childNodes[0].nodeValue);document.write("</td>");document.write("<td class='01'>");document.write(x[i].getElementsByTagName("rank")[0].childNodes[0].nodeValue);document.write("</td>");document.write("<td class='01'>");document.write(x[i].getElementsByTagName("playerLeaderboard")[0].childNodes[0].nodeValue);document.write("</td>");document.write("<td class='01'>");document.write(x[i].getElementsByTagName("airLeaderboard")[0].childNodes[0].nodeValue);document.write("</td>");document.write("<td class='01'>");document.write(x[i].getElementsByTagName("armorLeaderboard")[0].childNodes[0].nodeValue);document.write("</td>");document.write("<td class='01'>");document.write(x[i].getElementsByTagName("infantryLeaderboard")[0].childNodes[0].nodeValue);document.write("</td>");document.write("<td class='01'>");document.write(x[i].getElementsByTagName("supportLeaderboard")[0].childNodes[0].nodeValue);document.write("</td>");document.write("<td class='03'>");document.write(x[i].getElementsByTagName("lastPlayed")[0].childNodes[0].nodeValue);document.write("</td>");document.write("<td class='02'>");document.write(x[i].getElementsByTagName("totalScore")[0].childNodes[0].nodeValue);document.write("</td>");document.write("<td class='01'>");document.write(x[i].getElementsByTagName("numUnitsKilled")[0].childNodes[0].nodeValue);document.write("</td>");document.write("<td class='01'>");document.write(x[i].getElementsByTagName("numUnitsLost")[0].childNodes[0].nodeValue);document.write("</td>");document.write("</tr>");}document.write("</table>");}<!--********************--><!--Start Officers--><!--********************-->if (xmlDoc!=null){xmlDoc.async=false;xmlDoc.load("http://www.massgate.net/xml-player.php?id=352899");document.write("<table class='roster'>");var x=xmlDoc.getElementsByTagName("player");for (i=0;i<x.length;i++){ document.write("<tr class='d2'>");document.write("<td class='02'>");document.write(x[i].getElementsByTagName("name")[0].childNodes[0].nodeValue);document.write("</td>");document.write("<td class='01'>");document.write(x[i].getElementsByTagName("rank")[0].childNodes[0].nodeValue);document.write("</td>");document.write("<td class='01'>");document.write(x[i].getElementsByTagName("playerLeaderboard")[0].childNodes[0].nodeValue);document.write("</td>");document.write("<td class='01'>");document.write(x[i].getElementsByTagName("airLeaderboard")[0].childNodes[0].nodeValue);document.write("</td>");document.write("<td class='01'>");document.write(x[i].getElementsByTagName("armorLeaderboard")[0].childNodes[0].nodeValue);document.write("</td>");document.write("<td class='01'>");document.write(x[i].getElementsByTagName("infantryLeaderboard")[0].childNodes[0].nodeValue);document.write("</td>");document.write("<td class='01'>");document.write(x[i].getElementsByTagName("supportLeaderboard")[0].childNodes[0].nodeValue);document.write("</td>");document.write("<td class='03'>");document.write(x[i].getElementsByTagName("lastPlayed")[0].childNodes[0].nodeValue);document.write("</td>");document.write("<td class='02'>");document.write(x[i].getElementsByTagName("totalScore")[0].childNodes[0].nodeValue);document.write("</td>");document.write("<td class='01'>");document.write(x[i].getElementsByTagName("numUnitsKilled")[0].childNodes[0].nodeValue);document.write("</td>");document.write("<td class='01'>");document.write(x[i].getElementsByTagName("numUnitsLost")[0].childNodes[0].nodeValue);document.write("</td>");document.write("</tr>");}document.write("</table>");}<!--********************--><!--Officer--><!--********************-->if (xmlDoc!=null){xmlDoc.async=false;xmlDoc.load("http://www.massgate.net/xml-player.php?id=336482");document.write("<table class='roster'>");var x=xmlDoc.getElementsByTagName("player");for (i=0;i<x.length;i++){ document.write("<tr class='d1'>");document.write("<td class='02'>");document.write(x[i].getElementsByTagName("name")[0].childNodes[0].nodeValue);document.write("</td>");document.write("<td class='01'>");document.write(x[i].getElementsByTagName("rank")[0].childNodes[0].nodeValue);document.write("</td>");document.write("<td class='01'>");document.write(x[i].getElementsByTagName("playerLeaderboard")[0].childNodes[0].nodeValue);document.write("</td>");document.write("<td class='01'>");document.write(x[i].getElementsByTagName("airLeaderboard")[0].childNodes[0].nodeValue);document.write("</td>");document.write("<td class='01'>");document.write(x[i].getElementsByTagName("armorLeaderboard")[0].childNodes[0].nodeValue);document.write("</td>");document.write("<td class='01'>");document.write(x[i].getElementsByTagName("infantryLeaderboard")[0].childNodes[0].nodeValue);document.write("</td>");document.write("<td class='01'>");document.write(x[i].getElementsByTagName("supportLeaderboard")[0].childNodes[0].nodeValue);document.write("</td>");document.write("<td class='03'>");document.write(x[i].getElementsByTagName("lastPlayed")[0].childNodes[0].nodeValue);document.write("</td>");document.write("<td class='02'>");document.write(x[i].getElementsByTagName("totalScore")[0].childNodes[0].nodeValue);document.write("</td>");document.write("<td class='01'>");document.write(x[i].getElementsByTagName("numUnitsKilled")[0].childNodes[0].nodeValue);document.write("</td>");document.write("<td class='01'>");document.write(x[i].getElementsByTagName("numUnitsLost")[0].childNodes[0].nodeValue);document.write("</td>");document.write("</tr>");}document.write("</table>");}<!--********************--><!--Officer--><!--********************-->if (xmlDoc!=null){xmlDoc.async=false;xmlDoc.load("http://www.massgate.net/xml-player.php?id=355309");document.write("<table class='roster'>");var x=xmlDoc.getElementsByTagName("player");for (i=0;i<x.length;i++){ document.write("<tr class='d2'>");document.write("<td class='02'>");document.write(x[i].getElementsByTagName("name")[0].childNodes[0].nodeValue);document.write("</td>");document.write("<td class='01'>");document.write(x[i].getElementsByTagName("rank")[0].childNodes[0].nodeValue);document.write("</td>");document.write("<td class='01'>");document.write(x[i].getElementsByTagName("playerLeaderboard")[0].childNodes[0].nodeValue);document.write("</td>");document.write("<td class='01'>");document.write(x[i].getElementsByTagName("airLeaderboard")[0].childNodes[0].nodeValue);document.write("</td>");document.write("<td class='01'>");document.write(x[i].getElementsByTagName("armorLeaderboard")[0].childNodes[0].nodeValue);document.write("</td>");document.write("<td class='01'>");document.write(x[i].getElementsByTagName("infantryLeaderboard")[0].childNodes[0].nodeValue);document.write("</td>");document.write("<td class='01'>");document.write(x[i].getElementsByTagName("supportLeaderboard")[0].childNodes[0].nodeValue);document.write("</td>");document.write("<td class='03'>");document.write(x[i].getElementsByTagName("lastPlayed")[0].childNodes[0].nodeValue);document.write("</td>");document.write("<td class='02'>");document.write(x[i].getElementsByTagName("totalScore")[0].childNodes[0].nodeValue);document.write("</td>");document.write("<td class='01'>");document.write(x[i].getElementsByTagName("numUnitsKilled")[0].childNodes[0].nodeValue);document.write("</td>");document.write("<td class='01'>");document.write(x[i].getElementsByTagName("numUnitsLost")[0].childNodes[0].nodeValue);document.write("</td>");document.write("</tr>");}document.write("</table>");}<!--********************--><!--Officer--><!--********************-->if (xmlDoc!=null){xmlDoc.async=false;xmlDoc.load("http://www.massgate.net/xml-player.php?id=188890");document.write("<table class='roster'>");var x=xmlDoc.getElementsByTagName("player");for (i=0;i<x.length;i++){ document.write("<tr class='d1'>");document.write("<td class='02'>");document.write(x[i].getElementsByTagName("name")[0].childNodes[0].nodeValue);document.write("</td>");document.write("<td class='01'>");document.write(x[i].getElementsByTagName("rank")[0].childNodes[0].nodeValue);document.write("</td>");document.write("<td class='01'>");document.write(x[i].getElementsByTagName("playerLeaderboard")[0].childNodes[0].nodeValue);document.write("</td>");document.write("<td class='01'>");document.write(x[i].getElementsByTagName("airLeaderboard")[0].childNodes[0].nodeValue);document.write("</td>");document.write("<td class='01'>");document.write(x[i].getElementsByTagName("armorLeaderboard")[0].childNodes[0].nodeValue);document.write("</td>");document.write("<td class='01'>");document.write(x[i].getElementsByTagName("infantryLeaderboard")[0].childNodes[0].nodeValue);document.write("</td>");document.write("<td class='01'>");document.write(x[i].getElementsByTagName("supportLeaderboard")[0].childNodes[0].nodeValue);document.write("</td>");document.write("<td class='03'>");document.write(x[i].getElementsByTagName("lastPlayed")[0].childNodes[0].nodeValue);document.write("</td>");document.write("<td class='02'>");document.write(x[i].getElementsByTagName("totalScore")[0].childNodes[0].nodeValue);document.write("</td>");document.write("<td class='01'>");document.write(x[i].getElementsByTagName("numUnitsKilled")[0].childNodes[0].nodeValue);document.write("</td>");document.write("<td class='01'>");document.write(x[i].getElementsByTagName("numUnitsLost")[0].childNodes[0].nodeValue);document.write("</td>");document.write("</tr>");}document.write("</table>");}</script></body></html>

Link to comment
Share on other sites

OMFG. I think I'm going to puke!You should really consider using XSLT instead of JavaScript. Your code can't get more sloppier than that.If not XSLT, at least consider using PHP's DOM. It's faster, more reliable, and with a little organization, it could be clearner too.Sorry, but I'm not going to try to solve this. It's just too damanged.

Link to comment
Share on other sites

OMFG. I think I'm going to puke!You should really consider using XSLT instead of JavaScript. Your code can't get more sloppier than that.If not XSLT, at least consider using PHP's DOM. It's faster, more reliable, and with a little organization, it could be clearner too.Sorry, but I'm not going to try to solve this. It's just too damanged.
Aww come on, I tried really hard and I impressed myself. Well I will learn XSLT and PHP's DOM and get back with you.
Link to comment
Share on other sites

That code really should be cleaned up. :)Original:

var x=xmlDoc.getElementsByTagName("player");for (i=0;i<x.length;i++){document.write("<tr class='d1'>");document.write("<td class='02'>");document.write(x[i].getElementsByTagName("name")[0].childNodes[0].nodeValue);document.write("</td>");document.write("<td class='01'>");document.write(x[i].getElementsByTagName("rank")[0].childNodes[0].nodeValue);document.write("</td>");document.write("<td class='01'>");document.write(x[i].getElementsByTagName("playerLeaderboard")[0].childNodes[0].nodeValue);document.write("</td>");document.write("<td class='01'>");document.write(x[i].getElementsByTagName("airLeaderboard")[0].childNodes[0].nodeValue);document.write("</td>");document.write("<td class='01'>");document.write(x[i].getElementsByTagName("armorLeaderboard")[0].childNodes[0].nodeValue);document.write("</td>");document.write("<td class='01'>");document.write(x[i].getElementsByTagName("infantryLeaderboard")[0].childNodes[0].nodeValue);document.write("</td>");document.write("<td class='01'>");document.write(x[i].getElementsByTagName("supportLeaderboard")[0].childNodes[0].nodeValue);document.write("</td>");document.write("<td class='03'>");document.write(x[i].getElementsByTagName("lastPlayed")[0].childNodes[0].nodeValue);document.write("</td>");document.write("<td class='02'>");document.write(x[i].getElementsByTagName("totalScore")[0].childNodes[0].nodeValue);document.write("</td>");document.write("<td class='01'>");document.write(x[i].getElementsByTagName("numUnitsKilled")[0].childNodes[0].nodeValue);document.write("</td>");document.write("<td class='01'>");document.write(x[i].getElementsByTagName("numUnitsLost")[0].childNodes[0].nodeValue);document.write("</td>");document.write("</tr>");}

Modified

function GetPlayerObject(playerNode){	// Add error handling here to deal with empty nodes...    var name = playerNode.getElementsByTagName("name")[0].childNodes[0].nodeValue;    var rank = playerNode.getElementsByTagName("rank")[0].childNodes[0].nodeValue;    var playerLeaderboard = playerNode.getElementsByTagName("playerLeaderboard")[0].childNodes[0].nodeValue    var airLeaderboard = playerNode.getElementsByTagName("airLeaderboard")[0].childNodes[0].nodeValue    	// etc...	// Build a player object using JSON.	var player = {		"name" : name,		"rank" : rank,		"playerLeaderboard" : playerLeaderboard,		"airLeaderboard" : airLeaderboard	}		// Return that object.	return player;}function GetPlayerHtml(player){	// Using the JSON object passed, build out the HTML string	var html = "<tr class='d1'>";	html += "<td class='02'>";	html += player.name;	html += "</td>";		html += "<td class='01'>";	html += player.rank;	html += "</td>";		html += "<td class='01'>";	html += player.playerLeaderboard;	html += "</td>";		html += "<td class='01'>";	html += player.airLeaderboard;	html += "</td>";		// etc...		html += "</tr>";		// And return it to the caller.	return html;}var playerNodes = xmlDoc.getElementsByTagName("player");// Loop through all the player nodesfor (i=0; i < playerNodes.length; i++){	// Get the player JSON object	var player = GetPlayerObject(playerNodes[i]);		// Write out the HTML	document.write(GetPlayerHtml(player));}

Link to comment
Share on other sites

This really confuses me... 1. I can't find JSON anywhere on W3Schools website. 2. Where do I tell it to actually print anything? 3. What error handling are you refering to?4. Here is what I came up with:

<html><head><style type="text/css">table.roster {	border: 0; cellpadding: 5; cellspacing: 1; background-color: #000000; text-align: center; font-size:11px; font-family:verdana;}table.roster td.01 {	width: 40px; }table.roster td.02 {	width: 80px;}table.roster td.03 {	width: 80px;}table.roster tr.d1 {	background-color: #999999; color: black;}table.roster tr.d2 {	background-color: #cccccc; color: black;}</style></head><body><script type="text/javascript">var xmlDoc=null;if (window.ActiveXObject){// code for IExmlDoc=new ActiveXObject("Microsoft.XMLDOM");}else if (document.implementation.createDocument){// code for Mozilla, Firefox, Opera, etc.xmlDoc=document.implementation.createDocument("","",null);}else{alert('Your browser cannot handle this script');}if (xmlDoc!=null){xmlDoc.async=false;xmlDoc.load("http://www.massgate.net/xml-player.php?id=336482");function GetPlayerObject(playerNode){	// Add error handling here to deal with empty nodes...	var name = playerNode.getElementsByTagName("name")[0].childNodes[0].nodeValue;	var rank = playerNode.getElementsByTagName("rank")[0].childNodes[0].nodeValue;	var country = playerNode.getElementsByTagName("country")[0].childNodes[0].nodeValue;	var favoriteRole = playerNode.getElementsByTagName("favoriteRole")[0].childNodes[0].nodeValue;	var lastPlayed = playerNode.getElementsByTagName("lastPlayed")[0].childNodes[0].nodeValue;	var playerLeaderboard = playerNode.getElementsByTagName("playerLeaderboard")[0].childNodes[0].nodeValue;	var airLeaderboard = playerNode.getElementsByTagName("airLeaderboard")[0].childNodes[0].nodeValue;	var armorLeaderboard = playerNode.getElementsByTagName("armorLeaderboard")[0].childNodes[0].nodeValue;	var infantryLeaderboard = playerNode.getElementsByTagName("infantryLeaderboard")[0].childNodes[0].nodeValue;	var supportLeaderboard = playerNode.getElementsByTagName("supportLeaderboard")[0].childNodes[0].nodeValue;	var totalScore = playerNode.getElementsByTagName("totalScore")[0].childNodes[0].nodeValue;	var numUnitsKilled = playerNode.getElementsByTagName("numUnitsKilled")[0].childNodes[0].nodeValue;	var numUnitsLost = playerNode.getElementsByTagName("numUnitsLost")[0].childNodes[0].nodeValue;		// Build a player object using JSON.			var player = {						"name" : name,			"rank" : rank,			"country" : country,			"favoriteRole" : favoriteRole,			"lastPlayed" : lastPlayed,			"playerLeaderboard" : playerLeaderboard,			"airLeaderboard" : airLeaderboard,			"armorLeaderboard" : armorLeaderboard,			"infantryLeaderboard" : infantryLeaderboard,			"supportLeaderboard" : supportLeaderboard,			"totalScore" : totalScore,			"numUnitsKilled" : numUnitsKilled,			"numUnitsLost" : numUnitsLost,		}		return player;}function GetPlayerHtml(player)}	// Using the JSON object passed, build out the HTML string	var html = "<tr class='d1'>";	html += "<td class='02'>";	html += player.name;	html += "</td>";	html += "<td class='01'>";	html += player.rank;	html += "</td>";	html += "<td class='02'>";	html += player.country;	html += "</td>";	html += "<td class='01'>";	html += player.favoriteRole;	html += "</td>";		html += "<td class='02'>";	html += player.lastPlayed;	html += "</td>";	html += "<td class='01'>";	html += player.playerLeaderboard;	html += "</td>";	html += "<td class='01'>";	html += player.airLeaderboard;	html += "</td>";	html += "<td class='01'>";	html += player.armorLeaderboard;	html += "</td>";	html += "<td class='01'>";	html += player.infantryLeaderboard;	html += "</td>";	html += "<td class='01'>";	html += player.supportLeaderboard;	html += "</td>";	html += "<td class='01'>";	html += player.totalScore;	html += "</td>";		html += "<td class='01'>";	html += player.numUnitsKilled;	html += "</td>";	html += "<td class='01'>";	html += player.numUnitsLost;	html += "</td>";		html += "</tr>";	// Return it to the caller	return html;}var playerNodes = xmlDoc.getElementsByTagName("player");</script></body></html>

Link to comment
Share on other sites

1. I can't find JSON anywhere on W3Schools website. 2. Where do I tell it to actually print anything? 3. What error handling are you refering to?4. Here is what I came up with:
1. There aren't any tutorials here at W3Schools that deal with JSON. You might check out this site for starters:http://www.json.org/2. This piece of code from my example is what loops through all the player nodes in your XML and then writes to the document:
var name = "Unknown Player";if(playerNode.getElementsByTagName("name").length > 0 && playerNode.getElementsByTagName("name")[0].childNodes.length > 0){    name = playerNode.getElementsByTagName("name")[0].childNodes[0].nodeValue;}

Link to comment
Share on other sites

Jesh, It doesnt look like im getting anywhere with this. Thanks for all the help though.

<html><head><style type="text/css">table.roster {	border: 0; cellpadding: 5; cellspacing: 1; background-color: #000000; text-align: center; font-size:11px; font-family:verdana;}table.roster td.01 {	width: 40px; }table.roster td.02 {	width: 80px;}table.roster td.03 {	width: 80px;}table.roster tr.d1 {	background-color: #999999; color: black;}table.roster tr.d2 {	background-color: #cccccc; color: black;}</style></head><body><script type="text/javascript">var xmlDoc=null;if (window.ActiveXObject){// code for IExmlDoc=new ActiveXObject("Microsoft.XMLDOM");}else if (document.implementation.createDocument){// code for Mozilla, Firefox, Opera, etc.xmlDoc=document.implementation.createDocument("","",null);}else{alert('Your browser cannot handle this script');}if (xmlDoc!=null){xmlDoc.async=false;xmlDoc.load("http://www.massgate.net/xml-player.php?id=336482");function GetPlayerObject(playerNode){	// Add error handling here to deal with empty nodes...	var name = playerNode.getElementsByTagName("name")[0].childNodes[0].nodeValue;	var rank = playerNode.getElementsByTagName("rank")[0].childNodes[0].nodeValue;	var country = playerNode.getElementsByTagName("country")[0].childNodes[0].nodeValue;	var favoriteRole = playerNode.getElementsByTagName("favoriteRole")[0].childNodes[0].nodeValue;	var lastPlayed = playerNode.getElementsByTagName("lastPlayed")[0].childNodes[0].nodeValue;	var playerLeaderboard = playerNode.getElementsByTagName("playerLeaderboard")[0].childNodes[0].nodeValue;	var airLeaderboard = playerNode.getElementsByTagName("airLeaderboard")[0].childNodes[0].nodeValue;	var armorLeaderboard = playerNode.getElementsByTagName("armorLeaderboard")[0].childNodes[0].nodeValue;	var infantryLeaderboard = playerNode.getElementsByTagName("infantryLeaderboard")[0].childNodes[0].nodeValue;	var supportLeaderboard = playerNode.getElementsByTagName("supportLeaderboard")[0].childNodes[0].nodeValue;	var totalScore = playerNode.getElementsByTagName("totalScore")[0].childNodes[0].nodeValue;	var numUnitsKilled = playerNode.getElementsByTagName("numUnitsKilled")[0].childNodes[0].nodeValue;	var numUnitsLost = playerNode.getElementsByTagName("numUnitsLost")[0].childNodes[0].nodeValue;		// Build a player object using JSON.			var player = {						"name" : name,			"rank" : rank,			"country" : country,			"favoriteRole" : favoriteRole,			"lastPlayed" : lastPlayed,			"playerLeaderboard" : playerLeaderboard,			"airLeaderboard" : airLeaderboard,			"armorLeaderboard" : armorLeaderboard,			"infantryLeaderboard" : infantryLeaderboard,			"supportLeaderboard" : supportLeaderboard,			"totalScore" : totalScore,			"numUnitsKilled" : numUnitsKilled,			"numUnitsLost" : numUnitsLost,		}		return player;}function GetPlayerHtml(player)}	// Using the JSON object passed, build out the HTML string	var html = "<tr class='d1'>";	html += "<td class='02'>";	html += player.name;	html += "</td>";	html += "<td class='01'>";	html += player.rank;	html += "</td>";	html += "<td class='01'>";	html += player.country;	html += "</td>";	html += "<td class='01'>";	html += player.favoriteRole;	html += "</td>";		html += "<td class='02'>";	html += player.lastPlayed;	html += "</td>";	html += "<td class='01'>";	html += player.playerLeaderboard;	html += "</td>";	html += "<td class='01'>";	html += player.airLeaderboard;	html += "</td>";	html += "<td class='01'>";	html += player.armorLeaderboard;	html += "</td>";	html += "<td class='01'>";	html += player.infantryLeaderboard;	html += "</td>";	html += "<td class='01'>";	html += player.supportLeaderboard;	html += "</td>";	html += "<td class='02'>";	html += player.totalScore;	html += "</td>";		html += "<td class='01'>";	html += player.numUnitsKilled;	html += "</td>";	html += "<td class='01'>";	html += player.numUnitsLost;	html += "</td>";		html += "</tr>";	// Return it to the caller	return html;}var playerNodes = xmlDoc.getElementsByTagName("player");// Loop through all the player nodesfor (i=0; i < playerNodes.length; i++){    // Get the player JSON object    var player = GetPlayerObject(playerNodes[i]);    // Write out the HTML    document.write(GetPlayerHtml(player));}</script></body></html>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...