我有與放大按鈕相關的dropdownlist和chek框相關的複選框列表。代碼示例是這樣的:在asp.net中使用Javascript客戶端驗證
<table class="style1">
<tr>
<td class="style10" colspan="6">
</td>
</tr>
<tr>
<td class="style6">
<asp:CheckBox ID="chkBoxChanl" AutoPostBack="false"
runat="server" Text="Channel"
CssClass="ChkBoxStyle" Font-Size="Small"
/> </td>
<td class="style7">
<asp:DropDownList ID="ddlChannel" runat="server" CssClass="ddl">
</asp:DropDownList> </td>
<td class="style6">
<asp:CheckBox ID="chkBoxParty" runat="server" Text="Party"
CssClass="ChkBoxStyle" Font-Size="Small" /> </td>
<td class="style7">
<asp:DropDownList ID="ddlParty" runat="server" CssClass="ddl">
</asp:DropDownList> </td>
<td class="style13">
<asp:CheckBox ID="chkBoxContntTyp" runat="server" Font-Bold="True"
Text="Content Type" CssClass="ChkBoxStyle" Font-Size="Small"/> </td>
<td class="style8" rowspan="2">
<asp:RadioButton ID="rdBtnNews" runat="server" Text="News" CssClass="RadioGroup" />
<asp:RadioButton ID="rdBtnTicker" runat="server" Text="Ticker" CssClass="RadioGroup" /> <asp:RadioButton ID="rdBtnBreakingNews"
runat="server" Text="Breaking News" CssClass="RadioGroup" />
</br></br><asp:RadioButton ID="rdBtnBeeper" runat="server" Text="Beeper" CssClass="RadioGroup" /> <asp:RadioButton
ID="rdBtnTalkshow" runat="server" Text="TalkShow" CssClass="RadioGroup" /></td>
</tr>
<tr>
<td class="style6">
<asp:CheckBox ID="chkBoxDate" runat="server" Font-Bold="True" Text="Date"
CssClass="ChkBoxStyle" Font-Size="Small" /> </td>
<td class="style7">
<asp:TextBox ID="tbFrom" runat="server" CssClass="tbDate"></asp:TextBox><asp:Label ID="Label5"
runat="server" Text="To"></asp:Label><asp:TextBox ID="tbTo"
runat="server" CssClass="tbDate"></asp:TextBox> </td>
<td class="style6">
<asp:CheckBox ID="chkBoxPerson" runat="server" Font-Bold="True" Text="Person"
CssClass="ChkBoxStyle" Font-Size="Small" /> </td>
<td class="style7">
<asp:DropDownList ID="ddlPerson" runat="server" CssClass="ddl">
</asp:DropDownList> </td>
<td class="style13">
</td>
</tr>
<tr>
<td class="style4">
<asp:CheckBox ID="chkBoxProgrm" runat="server" Font-Bold="True"
Text="Program" CssClass="ChkBoxStyle" Font-Size="Small"/> </td>
<td class="style3">
<asp:DropDownList ID="ddlProgram" runat="server" CssClass="ddl">
</asp:DropDownList> </td>
<td class="style5">
<asp:CheckBox ID="chkBoxProvince" runat="server" Font-Bold="True"
Text="Province" CssClass="ChkBoxStyle" Font-Size="Small"/> </td>
<td class="style3">
<asp:DropDownList ID="ddlProvince" runat="server" CssClass="ddl">
</asp:DropDownList> </td>
<td class="style18">
<asp:CheckBox ID="chkContentTone" runat="server" Font-Bold="True"
Text="Content Tone" CssClass="ChkBoxStyle" Font-Size="Small"/> </td>
<td class="style9">
<asp:RadioButton ID="rdBtnPositive" runat="server" Text="Positive" CssClass="RadioGroup" /> <asp:RadioButton
ID="rdBtnNegative" runat="server" Text="Negative" CssClass="RadioGroup" /> <asp:RadioButton ID="rdBtnNeutral"
runat="server" Text="Neutral" CssClass="RadioGroup" /> </td>
</tr>
<tr>
<td class="style14">
<asp:Label ID="Label4" runat="server" Text="Keyword" Font-Names="Verdana,Arial"
Font-Bold="True" Font-Size="Small"></asp:Label> </td>
<td class="style15">
<asp:TextBox ID="tbKeyword" runat="server" CssClass="tb"></asp:TextBox> </td>
<td class="style14">
<asp:CheckBox ID="chkBoxCity" runat="server" Font-Bold="True" Text="City"
CssClass="ChkBoxStyle" Font-Size="Small"/> </td>
<td class="style15">
<asp:DropDownList ID="ddlCity" runat="server" CssClass="ddl">
</asp:DropDownList> </td>
<td class="style16">
</td>
<td class="style17">
<asp:Button ID="Button1" runat="server" Text="Search" CssClass="button" />
<asp:Button ID="Button2"
runat="server" Text="Report" CssClass="button" /></td>
</tr>
</table>
這就是這樣顯示的。
但我想禁用頁面加載時的所有下拉列表和單選按鈕,當我在複選框上選中時,只啓用相關的dropdownliast或複選框組。喜歡這個。 當我檢查複選框(內容類型)時,單選按鈕組變爲可用。 我想要當我檢查任何複選框,然後相關的下拉列表或一組單選按鈕變爲啓用。 所有我想在客戶端(服務器端是我已經知道的不好的做法)的Java腳本。 任何想法,因爲我從過去2天搜索,沒有找到任何結果!
你使用jQuery庫? –
不是!有沒有? – Mohsinjan110
不要吹你的酷。我剛纔問:)沒關係。由於日益增加的JavaScript複雜性,我將等待您準備好使用jQuery。實際上,這個問題可能會在jQuery中用7行代碼實現,但我懶得把它翻譯成普通的JavaScript –