首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

求JS 的 DropDownList联动 送分啦!该如何解决

2013-03-12 
求JS 的 DropDownList联动 送分啦!tr classFontFamilytd classtd stylewidth: 16% height: 24

求JS 的 DropDownList联动 送分啦!
<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?
[解决办法]
汗  还以为类似省市联动的呢
功能的却很简单  用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>


[解决办法]
$('#<%=CT_Year.ClientID%>')

热点排行