vb.net的下拉框联动无刷新

Protected dtc As DataTable

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'在此处放置初始化页的用户代码
dtc = GetTable("select * from city")

DropDownList1.Attributes("onchange") = "SCity(this.value)"

< scripttype = text / javascript >
varcitys
= new Array();
<%
for i as Integer = 0 todtc.Rows.Count - 1
%>
citys[
<%= i %> ] = new Array( " <%=Convert.ToString(dtc.Rows(i)( " proid " ))%> " , " <%=Convert.ToString(dtc.Rows(i)( " names " ))%> " , " <%=Convert.ToString(dtc.Rows(i)( " id " ))%> " );
<%
next
%>
functionSCity(obj)
{
document.getElementById(
" DropDownList2 " ).length = 0 ;
for (vari = 0 ;i < citys.length;i ++ )
{
if (obj == citys[i][ 0 ])
{
document.getElementById(
" DropDownList2 " ).options.add( new Option(citys[i][ 1 ],citys[i][ 2 ]))
}
}
}
</ script >

你可能感兴趣的:(JavaScript,.net,vb,VB.NET)