MarconiFS
10-29-2008, 06:14 AM
I have found the best RSS Ticker out there (in my opinion).
But if someone can find one similiar I would appreciate it as I am having trouble with editting this current one...
I got it from here (all files are zipped)... http://webcoding.co.uk/?page=blog45
And have put it in to practise here...
www. marconifs.co.uk/home-test.html
The trouble I am having is when the user clicks on the text it won't load until the ticker has finished "typing" the whole article. Then there is a 1 second gap before it loads the next feed.
So the user has to wait for it to load then be quick to click.
Could someone be so kind please to look at it for me?
function getRequest() {
var con = new Array();
var _ms_XMLHttpRequest_ActiveX = "";
var req;
if (window.XMLHttpRequest) {
req = new XMLHttpRequest();
} else if (window.ActiveXObject) {
if (_ms_XMLHttpRequest_ActiveX) {
req = new ActiveXObject(_ms_XMLHttpRequest_ActiveX);
} else {
var versions = ["Msxml2.XMLHTTP.7.0", "Msxml2.XMLHTTP.6.0", "Msxml2.XMLHTTP.5.0", "Msxml2.XMLHTTP.4.0", "MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP","Microsoft.XMLHTTP"];
for (var i = 0; i < versions.length ; i++) {
try {
req = new ActiveXObject(versions[i]);
if (req) {
_ms_XMLHttpRequest_ActiveX = versions[i];
break;
}
} catch (objException) {
// trap; try next one
}
}
}
}
con[0]=req;
con[1]=_ms_XMLHttpRequest_ActiveX;
return con;
}
function loadRSS(url) {
//alert("running");
try {
if ( _ms_XMLHttpRequest_ActiveX1 ) {
rssRequest.onreadystatechange = processRSS;
rssRequest.open("GET", url, true);
rssRequest.send(null);
} else {
if (rssRequest) {
rssRequest.onreadystatechange = processRSS;
rssRequest.open("GET", url, true);
rssRequest.send(null);
}
}
} catch ( rssRequestException ) {}
}
function getChildNode( myElement, naming ) {
return myElement.getElementsByTagName(naming)[0].firstChild.nodeValue;
}
function processRSS() {
var cycle = 0;
try {
if (rssRequest.readyState == 4) {
if (rssRequest.status == 200) {
response = rssRequest.responseXML.documentElement;
if ( response ) {
var items = response.getElementsByTagName("item");
for ( var i = 0 ; i < items.length; i++ )
{
var title = getChildNode(items[i],"title");
var desc = getChildNode(items[i],"description");
var link = getChildNode(items[i],"link");
rssItems[cycle] = title + " - " + desc;
linkItems[cycle] = link;
++cycle;
}
}
} else {
alert("There was a problem retrieving the XML data:\n" + req.statusText);
}
}
} catch ( jsException ) {alert(jsException.message);}
}
var httpArc2 = getRequest();
var rssRequest = httpArc2[0];
var _ms_XMLHttpRequest_ActiveX1 = httpArc2[1];
var rssItems = new Array();
var linkItems = new Array();
function openWindow(url){
window.open(url);
}
var storyCount = 0;
var itemLen = 0;
function tickTock(){
var obj = document.getElementById("scroller");
var myTimeout = 50;
var str;
var st = rssItems[storyCount];
if ( itemLen > st.length ) {
storyCount++;
if ( storyCount >= rssItems.length ) {
storyCount = 0;
}
itemLen = 0;
myTimeout=2000;
setTimeout("tickTock()", myTimeout);
} else {
++itemLen;
str = rssItems[storyCount].toString();
str = str.substring(0,itemLen) + "_";
obj.innerHTML = "<span class=globalheader>LATEST NEWS: </span><a href=\"javascript:openWindow('"+linkItems[storyCount]+"')\" class=headlines>" + str + "</a>";
setTimeout("tickTock()", myTimeout);
}
}
setTimeout("tickTock()", 3000);
loadRSS("/rss/grab.php?http://news.bbc.co.uk/rss/newsonline_world_edition/front_page/rss.xml");
But if someone can find one similiar I would appreciate it as I am having trouble with editting this current one...
I got it from here (all files are zipped)... http://webcoding.co.uk/?page=blog45
And have put it in to practise here...
www. marconifs.co.uk/home-test.html
The trouble I am having is when the user clicks on the text it won't load until the ticker has finished "typing" the whole article. Then there is a 1 second gap before it loads the next feed.
So the user has to wait for it to load then be quick to click.
Could someone be so kind please to look at it for me?
function getRequest() {
var con = new Array();
var _ms_XMLHttpRequest_ActiveX = "";
var req;
if (window.XMLHttpRequest) {
req = new XMLHttpRequest();
} else if (window.ActiveXObject) {
if (_ms_XMLHttpRequest_ActiveX) {
req = new ActiveXObject(_ms_XMLHttpRequest_ActiveX);
} else {
var versions = ["Msxml2.XMLHTTP.7.0", "Msxml2.XMLHTTP.6.0", "Msxml2.XMLHTTP.5.0", "Msxml2.XMLHTTP.4.0", "MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP","Microsoft.XMLHTTP"];
for (var i = 0; i < versions.length ; i++) {
try {
req = new ActiveXObject(versions[i]);
if (req) {
_ms_XMLHttpRequest_ActiveX = versions[i];
break;
}
} catch (objException) {
// trap; try next one
}
}
}
}
con[0]=req;
con[1]=_ms_XMLHttpRequest_ActiveX;
return con;
}
function loadRSS(url) {
//alert("running");
try {
if ( _ms_XMLHttpRequest_ActiveX1 ) {
rssRequest.onreadystatechange = processRSS;
rssRequest.open("GET", url, true);
rssRequest.send(null);
} else {
if (rssRequest) {
rssRequest.onreadystatechange = processRSS;
rssRequest.open("GET", url, true);
rssRequest.send(null);
}
}
} catch ( rssRequestException ) {}
}
function getChildNode( myElement, naming ) {
return myElement.getElementsByTagName(naming)[0].firstChild.nodeValue;
}
function processRSS() {
var cycle = 0;
try {
if (rssRequest.readyState == 4) {
if (rssRequest.status == 200) {
response = rssRequest.responseXML.documentElement;
if ( response ) {
var items = response.getElementsByTagName("item");
for ( var i = 0 ; i < items.length; i++ )
{
var title = getChildNode(items[i],"title");
var desc = getChildNode(items[i],"description");
var link = getChildNode(items[i],"link");
rssItems[cycle] = title + " - " + desc;
linkItems[cycle] = link;
++cycle;
}
}
} else {
alert("There was a problem retrieving the XML data:\n" + req.statusText);
}
}
} catch ( jsException ) {alert(jsException.message);}
}
var httpArc2 = getRequest();
var rssRequest = httpArc2[0];
var _ms_XMLHttpRequest_ActiveX1 = httpArc2[1];
var rssItems = new Array();
var linkItems = new Array();
function openWindow(url){
window.open(url);
}
var storyCount = 0;
var itemLen = 0;
function tickTock(){
var obj = document.getElementById("scroller");
var myTimeout = 50;
var str;
var st = rssItems[storyCount];
if ( itemLen > st.length ) {
storyCount++;
if ( storyCount >= rssItems.length ) {
storyCount = 0;
}
itemLen = 0;
myTimeout=2000;
setTimeout("tickTock()", myTimeout);
} else {
++itemLen;
str = rssItems[storyCount].toString();
str = str.substring(0,itemLen) + "_";
obj.innerHTML = "<span class=globalheader>LATEST NEWS: </span><a href=\"javascript:openWindow('"+linkItems[storyCount]+"')\" class=headlines>" + str + "</a>";
setTimeout("tickTock()", myTimeout);
}
}
setTimeout("tickTock()", 3000);
loadRSS("/rss/grab.php?http://news.bbc.co.uk/rss/newsonline_world_edition/front_page/rss.xml");
