javascript使用xml 数据岛 简单实例

 javascript使用xml 数据岛 简单实例

<script language='javascript'>
     function test()
     {
      
     alert('xml');


      var rs, option1;
      rs = xmlCustomer.recordset;
     alert(rs);
      
     alert(xmlCustomer.recordset.recordcount);
     for (var i=0; i < xmlCustomer.recordset.recordcount; i++)   
      {
      //option1 = document.createElement("OPTION");
      //option1.text = rs("CustomerCode");
      //option1.value = rs("CustomerName");
      //alert(option1.text);
      //alert(option1.value);
           
      document.all["ddlCustomer"].options[i] = new Option(rs("CustomerCode"),rs("CustomerName"));
           
      //ddlCustomer.add(option1);
      rs.movenext;
      }
        
         
     }
     </script>
     <XML id="xmlCustomer" >

     <ROOT>
      <Customer>
      <CustomerCode>ABC Corp.</CustomerCode>
      <CustomerName>1</CustomerName>
      </Customer>
      <Customer>
      <CustomerCode>BBC Tech.</CustomerCode>
      <CustomerName>2</CustomerName>
      </Customer>
     </ROOT>
     </XML>
             <select ID="ddlCustomer" name="ddlCustomer" runat="server"></select><input type=button value='ok' onclick='test()'>

上一篇:你能打造一个飞行机器人的大脑吗?


下一篇:iOS 11升级后常见的几个问题与解决的建议