asp.net实现无刷新DropDownList联动:
<%@ Page language="c#" Codebehind="Example.aspx.cs" AutoEventWireup="false" Inherits="Webs.other.Example" %>
<HTML>
<HEAD>
<title>Example</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
<script>
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");
oHttpReq.open("POST", "getData.aspx?state="+state, false);
oHttpReq.send("");
result = oHttpReq.responseText;
oDoc.loadXML(result);
items1 = oDoc.selectNodes("//CITY/Table/Id");
items2 = oDoc.selectNodes("//CITY/Table/shiname");
var itemsLength=items1.length;
for(i=0;i<itemsLength;i++)
//将小类的类名和编号赋予DropDownList2
{
asp.net实现无刷新DropDownList联动
最新推荐文章于 2017-04-17 14:54:36 发布
本文介绍如何在ASP.NET中实现无刷新的DropdownList联动效果,通过JavaScript和XMLHttpRequest对象发送请求,获取并更新第二个DropdownList的数据,从而提供更流畅的用户体验。
摘要由CSDN通过智能技术生成