|
Thanks for your feedback. Admittedly, a better way to do it would have been to place the links inside anchor (<a>) elements instead of <div> elements. This would make the links active. However it's easy to modify the code to do so. Here are the steps to make the channel link active:
1) Change the <div id="chan_link"></div> to <a id="chan_link" href=""></a> in the HTML file
2) Add the following line to the JavaScript code:
document.getElementById("chan_link").href = RSS.link;
Add this line just below the for loop that populated the channel elements (labelled /*B*/ in the code).
To do the same to the item links, use a similar approach:
1) Modify the HTML declared in the JavaScript code at the start of the showRSS(RSS) function. Specifically, substitute the "var startLink ..." line with the following two lines:
var startLink = "<a id='item_link' href='";
var endLink = "</a>";
2) Replace the "item_html += (RSS.items[i].link..." line with the following:
item_html += (RSS.items[i].link == null) ? "" : startLink + RSS.items[i].link + "'>"+ RSS.items[i].link + endLink;
The links themselves may not work, as I have used old sample RSS feeds that may be outdated. In conjunction with this reader, you will need to implement a server-side script that actually rebuilds the RSS files on a regular basis, thus keeping the content fresh and avoiding outdated links.
I hope you found that helpful!
Paul Sobocinski. (author)
|