﻿// JScript 文件
var request;
function createRequest() {
  try {
    request = new XMLHttpRequest();
  } catch (trymicrosoft) {
    try {
      request = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (othermicrosoft) {
      try {
        request = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (failed) {
        request = false;
      }
    }
  }
  if (!request)
    alert("Error initializing XMLHttpRequest!");
}
//*******
//第一个请求
//*******
function getCustomerInfo(page,perpage) {
  createRequest();
  var url='ShowLink.ashx?Page='+page+'&perpage='+perpage;
  request.open("GET",url,true);
  request.onreadystatechange=updatepage;
  request.send(null);
}
function updatepage(){
    if(request.readyState==4){
        if(request.status==200){
           printmsg();//处理服务器端返回的信息.
           
        }
    }
    else{
       document.getElementById("listmsg").style.display="block";
    }
}

function printmsg(){
    var xml=request.responseXML;   
    var date=new Date();                             //获得数据
if(xml==null)return;

var root=xml.documentElement;
if(root)                                                //如果存在

{
    document.getElementById("listmsg").style.display="none";
    //遍历每条数据，添加到mydiv
     var list=document.getElementById("mydiv");
     var s="<table border='0' width='100%' cellpadding='0' cellspacing='0'  style='border-collapse:collapse align=center'>";
     for(var i=0;i<root.childNodes.length;i++)//遍历行
     {
        var rootlist=root.childNodes[i];
        for(var j=0;j<rootlist.childNodes.length;j++)//遍历列
        {
            var s1="<tr>";
            s1+="<TD height='25'><img src='/image/biao.gif' width='7'height='7'>&nbsp;&nbsp;<a href='"+rootlist.childNodes[3].firstChild.nodeValue+"' target='_blank'>"+rootlist.childNodes[1].firstChild.nodeValue.substring(0,40)+"</a></TD>"
            s1+="<TD height='25'align='right'>"+rootlist.childNodes[2].firstChild.nodeValue.substring(0,10)+"&nbsp;&nbsp;</TD>"
        s1+="</tr><tr><td colspan='2' class='line'></td></tr>";

    
        }

        s+=s1
        list.innerHTML=s+"</table>"; 
     }
    
}


}

