<script>
function getCity() {
var provID = document.getElementById('<%=ddlPro.ClientID%>').value;
var context = '';
<% =CallBackCity() %>
}
function GetCitybyServer( context,timeMessage) {
alert(context);
var arrList=context.split(",");
if(document.getElementById('<%=ddlCity.ClientID%>')!=null)
{
var city=document.getElementById('<%=ddlCity.ClientID%>');
city.options.length=0;
for(j=0;j<arrList.length/2;j++)
{
city.options.add(new Option(arrList[2*j],arrList[2*j+1]));
}
}
}
function OnError(message, context) {
alert('数据连接错误:\n' + message);
} </script>
<asp:DropDownList ID="ddlType" runat="server">
<asp:ListItem>照片名称</asp:ListItem>
<asp:ListItem>会员名称</asp:ListItem>
</asp:DropDownList> 按类型:<asp:DropDownList ID="ddlModlType" runat="server">
<asp:ListItem Value="-1">请选择</asp:ListItem>
</asp:DropDownList> 按地区:<asp:DropDownList ID="ddlPro" runat="server" onchange="getCity();">
<asp:ListItem>选择地区</asp:ListItem>
</asp:DropDownList><asp:DropDownList ID="ddlCity" runat="server">
</asp:DropDownList>上面的方法竟然出错了 不能连动
但是 如果去掉 <asp:ListItem>照片名称</asp:ListItem>
<asp:ListItem>会员名称</asp:ListItem>
</asp:DropDownList> 按类型:<asp:DropDownList ID="ddlModlType" runat="server">
<asp:ListItem Value="-1">请选择</asp:ListItem>
</asp:DropDownList> 这个就OK 了 这是怎么回事 这跟DropDownList 有什么关系啊???
这是啥意思呢?清除options?
问题搞找到了 , 原来是<asp:ListItem>照片名称 </asp:ListItem>
<asp:ListItem>会员名称 </asp:ListItem>
</asp:DropDownList> 这个没有value 的问题
我加了value 就没问题了 但这是why ??