在CSDN下了本AJAX,看不很懂
下了本<AJAX新手快车道>,有点代码看不懂...
有耐心的高手帮解一下.
<script language= "JavaScript ">
var bloglist=new Array();
var xmlHttp=new ActiveXObject( "Msxml2.XMLHTTP ");
function startload(){
xmlHttp.open( "Get ", "http://www.blogjava.net/zbw25/Rss.aspx ",true);
xmlHttp.onreadystatechange=function(){
if(xmlHttp.readyState==4&&xmlHttp.status==200){
var xmldom=xmlHttp.responseXML;
var channel=xmldom.documentElement.childNodes.item(0);
var itemlist=channel.childNodes;
for(var i=0;i <itemlist.length;i++){
var node=itemlist.item(i);//channel中的第i项的子结点??
if(node.tageName== "title "){
blogtitle.innerHTML=node.text;
}
if(node.tageName== "link "){
bloglink.href=node.text;
}
if(node.tageName== "description "){
blogdescription=node.text;
}
if(node.tageName== "managingEditor "){
managionEditor.innerHTML=node.text;
}
if(node.tagName== "item "){
bloglist[bloglist.length]=node.childNodes;//node的子结点数组?node结点应是channel中的Item结点吧
}
}
showitem(bloglist[0]);//bloglist[0])Item结点的第个子结点?
}
}
xmlHttp.send(null);
}
function showitem(itemlist)///这个itemlist是什么对像?数组?
{
for(var i=0;i <itemlist.length;i++){
var node=itemlist.item(i);
if(node.tagName== "title ")
{
itemtitle.innerHTML=node.text;
}
if(node.tagName== "link ")
{
itemlink.href=node.text;
}
if(node.tagName== "description ")
{
description.innerHTML=node.text;
}
if(node.tagName== "author ")
{
author.innerHTML=node.text;
}
if(node.tagName== "pubDate ")
{
pubDate.innerHTML=node.text;
}
}
}
</script>
<body onload= "startload() ">
<font color=blue> <a id= "bloglink " href= "# "> <div id= "blogtitle "> </div> </a> </font>
<br>
By <font color=blue> <div id= "managingEditor "> </div> </font> <br/>
<font color=blue> <div id= "blogdescription "> </div> </font> <br/>
<br/>
<font color=#000066> <a id= "itemlink " href= "# "> <div id= "itemtitle "> </div> </a> <font> </br>
By <font color=blue> <div id= "author &q