Windows desktop gadget RSS Feed colour coding items
Posted
by padjo
on Stack Overflow
See other posts from Stack Overflow
or by padjo
Published on 2010-05-20T00:07:28Z
Indexed on
2010/05/20
0:10 UTC
Read the original article
Hit count: 263
I have a desktop gadget that pulls RSS Feeds from a website. The Feed contains information about issues - ie. Priority, Time, Description.
The Feed items are displayed on the desktop - however I need to colour code them according to their priority ie 1 = red etc. using the substr function - is there a better way to do this using JavaScript / HTML?
At the moment I've hacked together this - but is there a more elegant solution?
if (feed.item.description.substr(10,1) == "1")
{
document.write "<a href colour="red"" + item + ">";
else if (feed.item.description.substr(10,1) == "2")
{
document.write "<a href colour="yellow"" + item + ">";
else
{
document.write "<a href colour="green"" + item + ">";
© Stack Overflow or respective owner