...

View Full Version : XML-Javascript, change color of one element



sangren
10-20-2005, 07:40 PM
I have a javascript that pulls data from an XML document and outputs it as an HTML page. Now, I have determined how I can change the background color of that page, the text color of everything in that page, but not how to change one item. I would like to change the text color of just the artist element in this script, eveyrthing I have tried thus far returns errors.

for (var i=0; cds.length > i; i++)
{
var Title = cds[i].getElementsByTagName("title");
var Artist = cds[i].getElementsByTagName("artist");
var Company = cds[i].getElementsByTagName("company");
var Price = cds[i].getElementsByTagName("price");
results += i+1 + '. ' + '" ' + Title[0].firstChild.nodeValue + ' "' +
' performed by ' + Artist[0].firstChild.nodeValue + ' and distributed by '
+ Company[0].firstChild.nodeValue + '. ' + 'This album costs $' + Price[0].firstChild.nodeValue
+ '.' + "<br/>\n\r";
}

document.getElementById("displayresults").innerHTML = results

sangren
10-20-2005, 07:48 PM
I think I found my answer. Thanks everyone for the assistance.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum