I hope, I'm phrasing this right. I'm grabbing a value from a XML file, and I would like to add commas every thousands value (1234 -> 1,234 and 1234567 -> 1,234,567 and so on.)
Here is the script I'm using, borrowed from the w3schools website (I'm VERY new to javascript).
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.open("GET","http://ift.tt/1sah8Dw",false);
xmlhttp.send();
xmlDoc=xmlhttp.responseXML;
var x = xmlDoc.getElementsByTagName("groupDetails");
for (i=0;i<x.length;i++)
{
document.write("<b><font size='3' color='#00a0fe' face='Arial'>");
document.write(x[i].getElementsByTagName("memberCount")[0].childNodes[0].nodeValue);
document.write("</b></font>");
}
This is all being done through the script file, and not the html file. I've been through a few similar answers across the site, but was never able to apply the answers to my script. Hopefully someone can at least point me in the right direction.
No comments:
Post a Comment