Tuesday, July 1, 2008

Display Rss data througth Javascript

try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlHttp;
}function displayRSS(url)
{xmlhttp=GetXmlHttpObject();
if(xmlHttp==null)
{return;}
xmlHttp.open("GET",url,true);
xmlHttp.onreadystatechange=getRssFormat;
xmlHttp.send(null);
}
function getRssFormat()

{if(xmlHttp.readyState==4)
{if(xmlHttp.status != 200)
{
document.getElementById("rss").innerHTML= "Sorry....The Server did not return any results (Result code: 200). Please try again Sorry for the Inconvenience";
}
else{
var items_count=3;
link=new Array(), title=new  Array(), pubDate=new Array()
for(var  i=0; i0)?title[i].firstChild.nodeValue:"Untitled";
link_w=(link.length>0)?link[i].firstChild.nodeValue:"";
pubDate_w=pubDate[i];
litag = document.createElement("li");
linktag =document.createElement("a");
linktag.setAttribute("href",link_w);
linktag.appendChild(document.createTextNode(title_w + " (" + pubDate_w + ")"));
litag.appendChild(linktag);
ul.appendChild(litag);
}}}
if(xmlHttp.readyState==1 || xmlHttp.readyState==2 || xmlHttp.readyState==3)
{document.getElementById("rss").innerHTML='Please Wait....';
}}

No comments :

Post a Comment

AJAX, asp, Asp.net, asp.net and sql server security, Asp.net IntemIndex, C#, Css, DataBinder.Eval, DataKeyNames, Datalist, Datapager, DataSet, DataTable, DropDownList, FindControl, gridview, JavaScript, jquery, Listview, Paging, Regex, RegularExpression, Repeater, Server side validation, Sql Server, timer, timercallback, Validation, XML, xmlnode, XPath