function processSearch(){  //处理从服务端传回来的数据
    if(XMLHttpReq.readyState == 4) {
        if(XMLHttpReq.status == 200) {
           var xmlDoc = XMLHttpReq.responseXML; // 取得DOM对象
           for(i=0;i<xmlDoc.getElementsByTagName("context").length;i++){
            var cId=xmlDoc.getElementsByTagName("ID")(i).firstChild.nodeValue;
            var cName=xmlDoc.getElementsByTagName("cName")(i).firstChild.nodeValue;
            var cAddress=xmlDoc.getElementsByTagName("cAddress")(i).firstChild.nodeValue;
            var cEmail=xmlDoc.getElementsByTagName("cEmail")(i).firstChild.nodeValue;
            var cPhone=xmlDoc.getElementsByTagName("cPhone")(i).firstChild.nodeValue;
         //创建一个<tr>
           var tr=document.createElement("tr");
           tr.setAttribute("id",cId);
           tr.appendChild(createTd(cId));
           tr.appendChild(createTd(cName));
           tr.appendChild(createTd(cAddress));
           tr.appendChild(createTd(cEmail));
           tr.appendChild(createTd(cPhone));    
        //创建一个"删除"按钮并为其添加删除事件 
           var deleteButton=document.createElement("input");
           deleteButton.setAttribute("name","delete");
           deleteButton.setAttribute("type","button");
           deleteButton.setAttribute("value","删除");  
           deleteButton.setAttribute("id",cId);
           deleteButton.onclick=function(){ deleteContact(cId); };   //添加删除事件
           var td1=document.createElement("td");
           td1.appendChild(deleteButton);
           tr.appendChild(td1);
        //添加一个"修改"按钮并为其添加修改事件
           var modifyButton=document.createElement("input");
           modifyButton.setAttribute("id","modify");
           modifyButton.setAttribute("type","button");
           modifyButton.setAttribute("value","修改");
           modifyButton.onclick=function(){ modifydeleteContact(cId) }; //添加修改事件
           var td2=document.createElement("td");
           td2.appendChild(modifyButton);
           tr.appendChild(td2); 
       //在指定位置显示
           document.getElementById("show").appendChild(tr);
         }
        }else{
           window.alert("页面请求有异常");
          }
  }
  }
function deleteContact(cId){
   window.alert(cId);
}//各位帮忙看下上面代码...问题:
当点击"删除","修改"两个按钮时..都能响应但在事件中获取到的cId的都一样..
即循环的最后一次cId值...这是为什么?