I get, format and display a RSS feed usingt he below code. I want to make it Chrome compatible. Unfortunately i've used ActiveXObject("Microsoft.XMLDOM"), anyone know how i comply with Chroem (and probably majority) browser?
I have tried the following if statment to steer non-ie browsers to alt code but the alt code doesnt work - i havnt managed to populate the rss var.
if (window.DOMParser) {
parser = new DOMParser();
xmlDoc = parser.parseFromString("RSS.xml", "text/xml");
}
else // Internet Explorer
{
var rss = new ActiveXObject("Microsoft.XMLDOM")
rss.async = false
rss.load("RSS.xml")
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<script type="text/javascript">
var sText = ""
var i=0
var iNews=0
var rss = new ActiveXObject("Microsoft.XMLDOM")
rss.async = false
rss.load("http://feeds.bbci.co.uk/news/england/rss.xml")
function GetNewsSource(){
var itemNodes = rss.selectNodes("/rss/channel/item")
var iMax = itemNodes.length
sText = itemNodes.item(iNews).getElementsByTagName("title").item(0).text
myTicker.href = itemNodes.item(iNews).getElementsByTagName("link").item(0).text
ticker()
iNews+=1
if(iNews==iMax){
iNews=0
}
window.setTimeout("GetNewsSource()", (90*sText.length +4000))
}
function ticker(){
i+=1
myTicker.innerText = sText.substring(0,i) + " _"
if(i<sText.length){
window.setTimeout("ticker()",90)
}
else{
i=0
}
}
</script>
</head>
<body bgcolor="#B10000" text="#FFFFFF" link="#FFFFCC" vlink="#FFFFCC" alink="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="GetNewsSource()">
<a id="myTicker" href="" target="_parent"></a>
</body>
</html>