日期:2009-12-12  浏览次数:20468 次

 <TITLE>WebForm2</TITLE>

  <SCRIPT language='javascript'>
  function load(){
    var drp2 = document.getElementById("DropDownList2");
    drp2.innerText="";
    for(var i = 0;i<=drp2.options.length -1;i++){
     drp2.remove(i);
    }
    var drp3 = document.getElementById("DropDownList3");
    for(var i = 0;i<=drp3.options.length -1;i++){
     drp3.remove(i);
    }
    var xmlhttp = new ActiveXObject("MSXML2.XMLHTTP");
    var oDoc = new ActiveXObject("MSXML2.DOMDocument");
    var state=document.getElementById("DropDownList1").value;
    xmlhttp.open("POST", "webform1.aspx?id="+state,false);
    xmlhttp.send("");
    var res=oDoc.loadXML(xmlhttp.responseText);
    var naItems = oDoc.selectNodes("//Market/Table/maName");
    var idItems = oDoc.selectNodes("//Market/Table/maId");
    var item;
    var id;
    for (item = naItems.nextNode(),id=idItems.nextNode(); item&&id; item = naItems.nextNode(),id=idItems.nextNode()){
     var nastr = item.nodeTypedValue;
     var idstr = id.nodeTypedValue;
     var newOption = document.createElement("OPTION");
     newOption.text =nastr;
     newOption.value = idstr;
     
     
     drp2.options.add(newOption);
    }
    load2();
  
  }
  function load2(){
    var drp2 = document.getElementById("DropDownList3");
    drp2.innerText="";
    for(var i = 0;i<=drp2.options.length -1;i++){
     drp2.remove(i);
    }
    var xmlhttp = new ActiveXObject("MSXML2.XMLHTTP");
    var oDoc = new ActiveXObject("MSXML2.DOMDocument");
    var state=document.getElementById("DropDownList2").value;
    xmlhttp.open("POST", "webform3.aspx?id="+state,false);
    xmlhttp.send("");
    var res=oDoc.loadXML(xmlhttp.responseText);
    var naItems = oDoc.selectNodes("//Market/Table/maName");
    var idItems = oDoc.selectNodes("//Market/Table/maId");
    var item;
    var id;
    for (item = naItems.nextNode(),id=idItems.nextNode(); item&&id; item = naItems.nextNode(),id=idItems.nextNode()){
     var nastr = item.nodeTypedValue;
     var idstr = id.nodeTypedValue;
     var newOption = document.createElement("OPTION");
     newOption.text =nastr;
     newOption.value = idstr;
     
     
     drp2.options.add(newOption);
    }
  
  }
  </SCRIPT>
 </HEAD>
 <BODY ms_positioning="GridLayout" onload="load()">
  <FORM id="Form1" method="post" runat="server">
   <ASP:DROPDOWNLIST id="DropDownList1" runat="server"></