<html>
<head>
<title>新闻列表简化型</title>
<script language="javascript">
function $(id)
{
return document.all[id];
}
</script>
<script language="javascript" defer>
function op(i)
{ coun=i
var xhr=new ActiveXObject("Microsoft.XMLHTTP");
Dom=null;
pp='a'
xhr.open("get","data.asp?coun="+coun,true);
xhr.onreadystatechange=$CallBack;
xhr.send(null);
function $CallBack()
{
if(xhr.readystate==1)
{
$("newsList").innerHTML="正在连结服务器";
}
else if(xhr.readystate==2 || xhr.readystate==3)
{
$("newsList").innerHTML="正在查询";
}
else if(xhr.readystate==4)
{
if (xhr.status==200)
{
Dom=xhr.responseXML;
$showList();
}
}
}
// download by http://www.jb51.net
function $showList() //$用于函数内调用,,{}里面调用
{
var count="";
var html="";
var items=Dom.selectNodes("//item");
count=Dom.selectSingleNode("//data").getAttribute("count"); //总数量
coun1=Dom.selectSingleNode("//data").getAttribute("coun"); //总数量
if(coun-1==0)
{
for(var i=1;i<count;i++)
{
html+="<div id=\"title\" fontcolor=\"black\">"+items[i].selectSingleNode("hits").text+" "+items[i].selectSingleNode("hits1").text+" "+items[i].selectSingleNode("hits2").text+" "+items[i].selectSingleNode("hits1").text+"</div>";
}}
else
{
for(var i=1;i<count;i++)
{
html+="<div id=\"title\" fontcolor=\"black\">"+items[i].selectSingleNode("hits").text+" "+items[i].selectSingleNode("hits1").text+" "+items[i].selectSingleNode("hits2").text+"</div>";
}}
$("newsList").innerHTML=html;
}
}
</script>
</head>
<body>
<div id="butt">
<a href="#" onMouseOver="javascript:op(1);">选择1</a>|| <a href="#" onMouseOver="javascript:op(2);">选择2</a>
</div>
<div id="newsList"></div>
<div id="pagestatus"></div>
</body>
</html>