26
2014
01

JS通过RadioButton是否选中来禁用或灰掉其后对应的DropDownList


// 选中的时候屏蔽其他两个的下拉框

function MS_disabled() {

    //alert(1);

    if (document.getElementById("ctl00_ContentPlaceHolder1_cbxPointID_MultiSelectDDL") != null) {

        //alert(document.getElementById("ctl00_ContentPlaceHolder1_cbxPointID_MultiSelectDDL"));

        document.getElementById("ctl00_ContentPlaceHolder1_cbxPointID_MultiSelectDDL").disabled = !document.getElementById('ctl00_ContentPlaceHolder1_radiobutton11').checked;

        document.getElementById("ctl00_ContentPlaceHolder1_cbxLocation_MultiSelectDDL").disabled = !document.getElementById('ctl00_ContentPlaceHolder1_radiobutton12').checked;

        document.getElementById("ctl00_ContentPlaceHolder1_cbxPointType_MultiSelectDDL").disabled = !document.getElementById('ctl00_ContentPlaceHolder1_radiobutton13').checked;

    }

}



<table id="tabSearch" >

             <tr>

                <td style="white-space:nowrap; padding-left:10px;">

                   <asp:RadioButton ID="radiobutton11" GroupName="selcetone" onclick="MS_disabled();" runat="server" Text="按参数:" AutoPostBack="false"/></td>

                <td>

                   <uc1:MultipleSelection ID="cbxPointID" runat="server" /></td>

                <td style="white-space:nowrap; padding-left:10px;">

                   <asp:RadioButton ID="radiobutton12"  GroupName="selcetone" onclick="MS_disabled();" runat="server" Text="按地址:" AutoPostBack="false" /></td>

                <td>

                   <uc1:MultipleSelection ID="cbxLocation"  runat="server"/></td>

                <td style="white-space:nowrap; padding-left:10px;">

                   <asp:RadioButton ID="radiobutton13" GroupName="selcetone" onclick="MS_disabled();" runat="server" Text="按类型:" AutoPostBack="false" /></td>

                <td>

                   <uc1:MultipleSelection ID="cbxPointType" runat="server"/></td><td></td>

             </tr>

 </table>


« 上一篇下一篇 »

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。