未兼容firefox <form id="form1" runat="server"> <div> <asp:dropdownlist id="dropdownlist1" runat="server"></asp:dropdownlist> <asp:dropdownlist id="dropdownlist2" runat="server"> <asp:ListItem Value="11">11</asp:ListItem></asp:dropdownlist> </div> </form> <mce:script type="text/javascript"><!-- function load(state) { var drp2 = document.getElementById("DropDownList2"); for (i = drp2.length; i >= 0; i--) { drp2.options.remove(i); } var oHttpReq = new ActiveXObject("MSXML2.XMLHTTP"); var oDoc = new ActiveXObject("MSXML2.DOMDocument"); // 这里使用escape可以解决中文的问题 oHttpReq.open("POST", "test2.aspx?state=" + escape(state), false); oHttpReq.send(""); result = oHttpReq.responseText; oDoc.loadXML(result); alert(result); items = oDoc.selectNodes("//ds/CityName"); for (var item = items.nextNode(); item; item = items.nextNode()) { var city = item.nodeTypedValue; alert(city); var newOption = document.createElement("OPTION"); newOption.text = city; newOption.value = city; drp2.options.add(newOption); } } // --></mce:script> protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.Bind(); } if (this.Request["state"] != null) { string state = this.Request["state"].ToString(); string sql = "SELECT CityName FROM dbo.ET_City WHERE CityID=" + state; DataSet ds = new DataSet("CITY"); DataSet ds2 = ETHaiNan.DBUtility.DbHelperSQL.Query(sql); ds = ds2; XmlTextWriter writer = new XmlTextWriter(Response.OutputStream, Response.ContentEncoding); writer.Formatting = Formatting.Indented; writer.Indentation = 4; writer.IndentChar= ' '; ds.WriteXml(writer); writer.Flush(); Response.End(); writer.Close(); } } private void Bind() { ArrayList list = new ArrayList(); for (int i = 11; i < 20; i++) { list.Add(i); } this.dropdownlist1.DataSource = list; this.dropdownlist1.DataBind(); this.dropdownlist1.Attributes.Add("onchange", "load(this.options[this.selectedIndex].innerText)"); } source http://blog.csdn.net/cuike519/archive/2004/08/22/81727.aspx