[問題] RadioButton選取之後的控制項致能與否??

看板Ajax作者 (kiy)時間13年前 (2012/08/04 09:47), 編輯推噓2(202)
留言4則, 2人參與, 最新討論串1/2 (看更多)
各位前輩好,小弟寫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

08/04 11:21, , 1F
有點記不太清楚了 你RADIO按下去會有PostBack發生嘛?
08/04 11:21, 1F

08/04 14:53, , 2F
兩個地方注意(1) PostBack有發生的話 會被洗掉
08/04 14:53, 2F

08/04 14:53, , 3F
(2)如果是WebForm 有套用MasterPage,Control的ID
08/04 14:53, 3F

08/04 14:54, , 4F
會被改變
08/04 14:54, 4F
文章代碼(AID): #1G77yd25 (Ajax)
文章代碼(AID): #1G77yd25 (Ajax)