Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Sep 2005
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts

    XML-Javascript, change color of one element

    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

  • #2
    New Coder
    Join Date
    Sep 2005
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I think I found my answer. Thanks everyone for the assistance.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •