0
我有一個JavaScript來調用時啓用文本框,當用戶從下拉列表中選擇值「自定義」時我想觸發此代碼,以便我可以顯示/隱藏這些新的文本框。來自ASP控件的客戶端JavaScript調用不會重置知名度
function setVisibility(DropDownListID) {
var element = document.getElementById(DropDownListID);
var element1 = document.getElementById("TestBox1");
if (element.value == "Custom") {
element1.visible = !element1.visible ;
}
<asp:DropDownList ID="DateRangeDropDownList" runat="server" Enabled="True" onChange="setVisibility('DateRangeDropDownList');">
<asp:ListItem>Some Value</asp:ListItem>
<asp:ListItem>Custom</asp:ListItem>
</asp:DropDownList>
<asp:TextBox ID="TestBox1" runat="server"></asp:TextBox>
由於某種原因,它似乎沒有工作。有任何想法嗎?