作者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