发了两个请求?好乱的代码。  建议把AJAX的东西封装好,。

解决方案 »

  1.   


    <head> 
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> 
    <title>无标题文档 </title> 
    <script> 
    function $(v) {return document.getElementById(v);} function loadchildren(divid){ 
    try {xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");} 
    catch(e){ 
    try {xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");} 
    catch(e){xmlHttp=false;} 

    if(!xmlHttp&&typeof XMLHttpRequest!='undefined'){xmlHttp=new XMLHttpRequest();} 

    if(xmlHttp){ 
    xmlHttp.open("GET","1.asp?id="+divid,true); 
    xmlHttp.onreadystatechange = function callback(){ 
    if(xmlHttp.readyState == 4) { 
    $(divid).setAttribute("loadIf",1) 
    switch(xmlHttp.status){ 
    case 200: 
    $(divid).innerHTML = xmlHttp.responseText; 
    break; 
    case 404: 
    alert('页面请求失败!'); 
    break; 



    xmlHttp.send(null); 

    } function a(){ 
    loadchildren("div1") 
    loadchildren("div2") 
    }onload=a 
    </script> 
    </head> 
    <body>
    <div id="div1">this div--1</div>
    <div id="div2">this div--2</div>
    </body>IIS5-OK
      

  2.   

    LS:
    xmlHttp.open("GET","http://127.0.0.1/debug/1.asp?id="+divid,true);
    -->
    xmlHttp.open("GET","1.asp?id="+divid,true);