PDA

View Full Version : Javascript & Rss ticker help



armator
10-25-2006, 08:25 AM
Dear Sirs

Kindly note following script is working in my local computer but it does not work in my web server .
Can you please help me where is the problem or which command I have to add in this code ?

Thanks advance your kind helps.

Best Regards
Armator

CODE
-----
<html>
<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://rss.news.yahoo.com/rss/world")

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 onLoad="GetNewsSource()">
<p><b>Latest News: <a id="myTicker" href=""></a></b></p>
</body>
</html>

</body>
</html>


-----