<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 strict//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" > <ptm L xmlns= "http://www.w3.org/1999/xhtml" > <pead> <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; Get channel VarCcc=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= "<p>" +headtitle+ "</p>"; 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; var cell = document.createelement ("div"); Cell.innerhtml= "" +title+ ""; document.getElementById ("Result"). AppendChild (cell); The function Readrss1 () {var Url=document.getelementbyid ("Txturl"). Value; if (url== "") {alert ("Please enter an RSS address"); } else { Readrss (URL); }} </script> </pead> <body "> <p>ajax Read RSS example </p> <form > B Logjava Original area Blogjava Novice area Blogjava non-technical area Integrated area Enter an RSS address: <input ty Pe= "text" value= "http://www.blogjava.net/wujun/rss.aspx" size=50 id= "Txturl" > <input type= "button" value= "View" Onclick= "Readrss1 ()" > </form> <div id= "result" ></div> </body> </ptml>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]