作者kiyasuto1 (kiy)
看板Ajax
標題[問題] RadioButton選取之後的控制項致能與否??
時間Sat Aug 4 09:47:16 2012
各位前輩好,小弟寫ASP.NET遇到一的問題
有關JAVASCRIPT如下
function fncEnable() {
if (RadioButton1.checked) {
document.DropDownList1.disabled = false;
document.DropDownList2.disabled = true;
}
else {
document.DropDownList1.disabled = true;
document.DropDownList2.disabled = false;
}
}
而HTML檔如下
<asp:RadioButton ID="RadioButton1" runat="server" Onclick="fncEnable()"
GroupName="r"/>
<asp:RadioButton ID="RadioButton2" runat="server" GroupName="r" />
<br />
<asp:DropDownList ID="DropDownList1" runat="server" >
</asp:DropDownList>
<asp:DropDownList ID="DropDownList2" runat="server" >
</asp:DropDownList>
但是都沒有反應...請前輩不吝指教!!感謝~
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 219.68.228.55
1F:推 saluyi:有點記不太清楚了 你RADIO按下去會有PostBack發生嘛? 08/04 11:21
2F:推 qwer820404:兩個地方注意(1) PostBack有發生的話 會被洗掉 08/04 14:53
3F:→ qwer820404:(2)如果是WebForm 有套用MasterPage,Control的ID 08/04 14:53
4F:→ qwer820404:會被改變 08/04 14:54