Automatically load Blogjava with Ajax Rss_ajax related to blog Park

Source: Internet
Author: User
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 strict//en"
"Http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" >
<title>this is test</title>
<script type= "Text/javascript" >
var xmlHttp;
function Createxmlhttprequest () {
if (window. ActiveXObject) {
XmlHttp = new ActiveXObject ("Microsoft.XMLHTTP");
}
else if (window. XMLHttpRequest) {
XmlHttp = new XMLHttpRequest ();
}
}
function Readrss (URL) {
Createxmlhttprequest ();
Xmlhttp.onreadystatechange = Handlestatechange;
Xmlhttp.open ("Get", url, True);
Xmlhttp.send (NULL);


}

function Handlestatechange () {
if (xmlhttp.readystate = = 4) {
if (Xmlhttp.status = = 200) {
ResultSet ();
}
}
}
function ResultSet () {
var results = Xmlhttp.responsexml;
var title = null;
var item = NULL;
var link=null;
var author=null;
var pubdate=null;
var description=null;
Get Channel
var ccc=results.getelementsbytagname ("channel");
var headtitle=ccc[0].getelementsbytagname ("title") [0].firstchild.nodevalue;
var headlink=ccc[0].getelementsbytagname ("link") [0].firstchild.nodevalue;
var cell = document.createelement ("div");
Cell.innerhtml= "document.getElementById ("Result"). AppendChild (cell);
Get items
var items = results.getelementsbytagname ("item");
for (var i = 0; i < items.length; i++) {
item = Items[i];
Link=item.getelementsbytagname ("link") [0].firstchild.nodevalue;
title = Item.getelementsbytagname ("title") [0].firstchild.nodevalue;
Author=item.getelementsbytagname ("author") [0].firstchild.nodevalue;
Pubdate= item.getelementsbytagname ("pubdate") [0].firstchild.nodevalue;
Description=item.getelementsbytagname ("description") [0].firstchild.nodevalue;
var cell = document.createelement ("div");
Cell.innerhtml= "<a href=" +link+ "target=_blank>" +title+ "</a><font color=red> &nbsp Author: </ Font> "+author+" <br> ";


document.getElementById ("Result"). AppendChild (cell);
var cell1=document.createelement ("div");
Cell1.innerhtml=description;
document.getElementById ("Result"). AppendChild (CELL1);
}
}
function Readrss1 ()
{
var Url=document.getelementbyid ("Txturl"). Value;
if (url== "")
{
Alert ("Please enter an RSS address");
}
Else
{
Readrss (URL);
}
}

var I=1;
var j=0;
function Read ()
{
if (j==0)
{
Readblogjava ();
Window.settimeout ("Testread ()", 100);
}
}

function Testread ()
{
Window.settimeout ("Read ()", 1000);
}

function Readblogjava ()
{
Switch (i)
{
Case (1):
i++;

Readrss ("http://www.blogjava.net/rss.aspx");
Break

Case (2):
i++;
Readrss (http://beginner.blogjava.net/rss.aspx);

Break

Case (3):
i++;
Readrss (http://general.blogjava.net/rss.aspx);
Break

Case (4):
i++;
Readrss (http://life.blogjava.net/rss.aspx);
Break

Blog Park's
Case (5):
i++;
Readrss (http://www.cnblogs.com/rss.aspx);
Break

Case (6):
i++;
Readrss (http://beginner.cnblogs.com/rss.aspx);
Break

Case (7):
i++;
Readrss (http://life.cnblogs.com/rss.aspx);
Break

Case (8):
i++;
Readrss (http://misc.cnblogs.com/rss.aspx);
Break

Case (9):
i++;
Readrss (http://cio.cnblogs.com/rss.aspx);
Break



Case (10):
i++;
Readrss (http://news.cnblogs.com/rss.aspx);
Break


Case (11):
i++;
Readrss (http://bookreview.cnblogs.com/rss.aspx);
Break


Case (12):
i++;
Readrss (http://job.cnblogs.com/rss.aspx);
Break

Case (13):
i++;
Readrss (http://gis.cnblogs.com/rss.aspx);
Break

Case (14):
i++;
Readrss (http://clubs.cnblogs.com/rss.aspx);
Break

Case (15):
i++;
Readrss (http://software.cnblogs.com/rss.aspx);
Break
Default
Alert ("Load complete!");
i++;
j + +;
Break
}
}

</script>
<body Onload=testread () >

<form >

Enter an RSS address: <input type= "text" value= "http://www.blogjava.net/wujun/rss.aspx" size=50 id= "Txturl" >
<input type= "button" value= "View" onclick= "Readrss1 ()" >
<input type= "button" onclick= "Hideobject ()" value= "Test" >
</form>
<div id= "Result" ></div>
<embed style= "POSITION:ABSOLUTE;TOP:1PX;LEFT:1PX; "Align=right
src=http://www.nice.or.jp/~mosmos/free/f105.swf width=200 height=200
Type=application/x-shockwave-flash; quality= "High" wmode= "Transparent" ></EMBED>
</body>
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.