【发布时间】:2011-01-23 15:47:30
【问题描述】:
例如:-- 当我输入“A”时,所有以 A 开头的元素都应该显示出来……如果是“B”,那么带有 B 的元素……等等)
例如:
<asp:DropDownList ID="ddlLocation" style="width:140px" runat="server">
<asp:ListItem Value="1" >India</asp:ListItem>
<asp:ListItem Value="2" >India - Hyderabad</asp:ListItem>
<asp:ListItem Value="3">South Africa</asp:ListItem>
<asp:ListItem Value="4">Australia</asp:ListItem>
</asp:DropDownList>
javascript:
function DisplayText()
{
var textboxId = '<% = txtText.ClientID %>';
var dropdownListId = '<% = ddlLocation.ClientID %>';
document.getElementById(textboxId).value = document.getElementById(dropdownListId).value;
document.getElementById(textboxId).focus();
}
后面的代码:
ddlLocation.Attributes.Add("onChange", "DisplayText();");
问候 拉维,
【问题讨论】:
标签: c# .net asp.net javascript dhtml