日期:2014-05-16 浏览次数:20411 次
function showAreaData(weekId){ var currTR = event.srcElement.parentNode; if(hasData==true && lastCell == weekId){ for(var s = 1 ; s <= n ; s ++){ currTR.parentNode.removeChild(currTR.nextSibling); } hasData = false; }else{ if(hasData == true && lastCell != weekId){ for(var s = 1 ; s <= n ; s ++){ lastTR.parentNode.removeChild(lastTR.nextSibling); } hasData = false; } var productType = form.productType.value; var businessType = form.businessType.value; var serviceLevel = form.serviceLevel.value; var customGroup = form.customGroup.value; var areaId = form.areaNo.value; //alert(areaId+" "+weekId+" "+productType+" "+businessType+" "+serviceLevel+" "+customGroup); var xmlhttp = createXHR(); xmlhttp.onreadystatechange = function(){ if(xmlhttp.readyState == 4){ if(xmlhttp.status == 200){ var responseText = xmlhttp.responseText; var trs = responseText.split("<tr>"); for(var i = 1 ; i < trs.length; i ++ ){ n = i; var tr = trs[i].split("</tr>")[0]; //alert(tr); var tds = tr.split('<td>'); //创建tr var trNode = document.createElement("<tr id='TR_"+weekId+""+i+"' style='display:block;'></tr>"); for(var j = 1 ; j < tds.length; j ++){ var td = tds[j].split("</td>")[0]; //alert(td); //创建td并添加到tr var tdNode = document.createElement("<td align='right'></td>"); tdNode.innerHTML = td; trNode.appendChild(tdNode); } //追加tr currTR.parentNode.insertBefore(trNode,currTR.nextSibling); } } } } var URL = "TotalAnalysisWeek.action?flag=getAreaData&weekId="+weekId+"&productType="+productType +"&businessType="+businessType+"&serviceLevel="+serviceLevel+"&customGroup="+customGroup +"&areaId="+areaId; xmlhttp.open("post",URL,false); xmlhttp.send(null); hasData = true; lastCell = weekId; } lastTR = currTR; }