<script type="text/javascript">
function ddl(id) {
// var id = document.getElementById('<%=DDLquestionType.ClientID%>').value;
if (id == "Open") {
AmericanAnswer.style.display = 'none';
document.getElementById('Answer1_Btn').style.visibility = false;
}
alert(id);
}
</script>
<asp:DropDownList ID="DDLquestionType" CssClass="ddlQuestionType box" runat="server" AutoPostBack="True" onchange="ddl(this)" >
<asp:ListItem Text="American" Value="American"></asp:ListItem>
<asp:ListItem Text="Open" Value="Open"></asp:ListItem>
<asp:ListItem Text="Yes/No" Value="YesNo"></asp:ListItem>
<asp:ListItem Text="Numerical" Value="Numerical"></asp:ListItem>
</asp:DropDownList>
我有這樣的Java腳本函數:
對此我嘗試在下拉列表中選擇更改
它不調用工作。 我也試過 onchange =「javascript:ddl()」和沒有參數的函數,ononchange =「javascript:ddl(this);」, ononchange =「javascript:ddl(this.value);」, 和很多其他。 我是新來的java腳本,任何解釋鏈接也將高度讚賞
請不要發佈您的代碼截圖。這就像去汽車修理店和你的車的照片。發佈您的代碼。 – Tomalak
@Tomalak只需複製粘貼或有更好的方法來做到這一點? – InnaS
當你編輯你的問題時,你應該看到一個黃色方塊,提示如何使用編輯器。其中包括如何發佈代碼。 – Tomalak