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()'>


原文链接: http://blog.csdn.net/newhappy2008/article/details/2255365

你可能感兴趣的:(javascript使用xml 数据岛 简单实例)