<tr class="FontFamily">
            <td class="td" style="width: 16%; height: 24px">
                &nbsp;计划类型<span style="color: #ff0000">*</span>
            </td>
            <td class="td1" colspan="3" style="width: 33%; height: 24px">
                <asp:DropDownList ID="CT_JHLX" runat="server" BorderStyle="None" Style="border-top-width: 0px;
                    border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" Width="99.7%" AutoPostBack="True" OnSelectedIndexChanged="CT_JHLX_SelectedIndexChanged">
                    <asp:ListItem>年度计划</asp:ListItem>
                    <asp:ListItem>月度计划</asp:ListItem>
                </asp:DropDownList> 
            </td>
            <td class="td" style="width: 16%; height: 24px">
                &nbsp;计划时间<span style="color: #ff0000">*</span>
            </td>
            <td class="td1" id="year" style="width: 33%; height: 24px">
                     <table align="left" border="0" cellpadding="0" cellspacing="0" unselectable="off" width="99.9%">
                    
                    <tr unselectable="off">
                        <td style="height: 17px">
                            <asp:DropDownList ID="CT_Year" runat="server" BorderStyle="None" Style="border-top-width: 0px;
                    border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" Width="80%">
                                <asp:ListItem>2010年</asp:ListItem>
                                <asp:ListItem>2011年</asp:ListItem>
                                <asp:ListItem>2012年</asp:ListItem>
                                <asp:ListItem>2013年</asp:ListItem>
                                <asp:ListItem>2014年</asp:ListItem>
                                <asp:ListItem>2015年</asp:ListItem>
                                <asp:ListItem>2016年</asp:ListItem>
                                <asp:ListItem>2017年</asp:ListItem>
                                <asp:ListItem>2018年</asp:ListItem>
                                <asp:ListItem>2019年</asp:ListItem>
                                <asp:ListItem>2020年</asp:ListItem>
                </asp:DropDownList>
               
                        </td>
                        <td style=" height: 17px" id="month">
                           <asp:DropDownList ID="CT_MON" runat="server" BorderStyle="None" Style="border-top-width: 0px;
                    border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" Width="80%">
                               <asp:ListItem>1月</asp:ListItem>
                               <asp:ListItem>2月</asp:ListItem>
                               <asp:ListItem>3月</asp:ListItem>
                               <asp:ListItem>4月</asp:ListItem>
                               <asp:ListItem>5月</asp:ListItem>
                               <asp:ListItem>6月</asp:ListItem>
                               <asp:ListItem>7月</asp:ListItem>
                               <asp:ListItem>8月</asp:ListItem>
                               <asp:ListItem>9月</asp:ListItem>
                               <asp:ListItem>10月</asp:ListItem>
                               <asp:ListItem>11月</asp:ListItem>
                               <asp:ListItem>12月</asp:ListItem>
                </asp:DropDownList> 
                
                        </td>
                    </tr>
                </table>
                
            </td>
        </tr>功能很简单 如果选择年度计划。。则隐藏或者(不可用)月份的DropDownList ,如果选月度计划则 年份和月份 都显示。求JS大神帮忙,本人JS新手。谢谢啦DropDownList 

解决方案 »

  1.   

    参考:
    http://www.popub.net/script/PCAS.html
      

  2.   

    汗  还以为类似省市联动的呢
    功能的却很简单  用jquery进行一个选中项筛选就可以了<!DOCTYPE HTML>
    <html>
    <head> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script> <script type="text/javascript">
    $(function(){
    $(".planType").change(function(){

    if($(".planType option:selected").val()=="yearPlan")
    {   //选中了年度计划 隐藏月的select
    $(".months").hide();
    }else{
    //选中了月度计划 让其显示出来
    $(".months").show();
    }
    })
    })

    </script></head>
    <body>
    <select class="planType">
    <option value="monthPlan">月度计划</option>
    <option value="yearPlan">年度计划</option>
    </select>

    <select class="years">
    <option>2010年</option>
    <option>2011年</option>
    <option>2012年</option>
    <option>2013年</option>
    <option>2014年</option>
    <option>2015年</option>
    <option>2016年</option>
    </select>

    <select class="months">
    <option>1月</option>
    <option>2月</option>
    <option>3月</option>
    <option>4月</option>
    <option>5月</option>
    <option>6月</option>
    <option>7月</option>
    </select>


    </body>
    </html>
      

  3.   

    我试了,不行啊
    $(function(){
        $("#CT_JHLX").change(function(){
            if($("#CT_JHLX option:selected").val()=="年度计划")
            {
                $("#CT_Year").hide; 
            } 
            else
            {
                $("#CT_Year").show(); 
            }
        })
    })问题是.net的DropDownList和HTML标签有区别啊。。
      

  4.   

    不行的哦这是服务器控件
    $('#<%=CT_Year.ClientID%>') 也找不到。