1
例如: - 當I型以A開頭的 「A」 的所有元素應顯示...如果 「B」,然後爲B元素....等)如何用JavaScript字典選項創建可編輯的下拉列表?
例:
<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();");
問候 ravi,