日期:2014-05-17  浏览次数:20719 次

div 怎么show不出来
选项卡弄成下面这个样子的
<table id="gNav" border="0" cellspacing="0" cellpadding="0">
<tr>
<td nowrap="nowrap" id="day_graph"><a>日期</a></td>
<td nowrap="nowrap" id="month_graph"><a>月份</a></td>
<td nowrap="nowrap" id="year_graph"><a>年</a></td>
</tr>
<tr>
</tr>
</table>

<!--------选项卡日期出下面这堆-->
<div id = "graph_day"  style="float:left">
<div id="contentBg_day">
<br/>

<div   style="text-align:left"><p>日期 <input type="text" width="8px" id="datepicker" />
<button type="button" id="btnClear" src = "/assets/icon_calendar.gif">クリア</button> 
<!--<td><%= image_tag("btn_clear.gif", {:width => 90, :height => 30, :onclick => "clearGraph()" }) %></td>-->
<button type="button" id="btnView">表示</button></p>
</div>
<div class="graphArea"><div id="div-day-chart">
</div>
</div>
</div>
<!--------月份出下面这堆-->
<div id = "graph_month" style="display:none;">
<div id="contentBg_month">
<br/>
<div><p>年月選択 
<button type="button" id="btnClear_month" src = "/assets/icon_calendar.gif">クリア</button> 
<button type="button" id="btnView_month">表示mikkk</button></p>
</div>
<div class="graphArea"><div id="div-month-chart">
</div>
</div>
</div>
......

jquery 这样写
jQuery(function() {
$("#day_graph").click(function(){
$("#graph_day").show();
$("#graph_month").hide();
});
$("#month_graph").click(function(){
$("#graph_day").hide();
$("#graph_month").show();
});
});

为什么选日期的时候可以出来,选月的时候就什么都没有
为什么呢?

------解决方案--------------------
我的感觉纯粹是,month div 因为没有 load 过 (display:none),所以显示不出来

你可以把那个 inline style 去掉

在页面上加一个 

$(document).ready(function() {
    $("#graph_month").hide();
});

然后再试试

------解决方案--------------------
jquery写的话干嘛还要给table td的id呢,可以直接获取eq: