我有一个带有日历和一堆“天气历史中的今天”信息的 html 文件。我想隐藏所有的天气历史,直到有人点击日历上的某一天,然后我只想显示那一天的历史。
每日天气信息是隐藏的,但当它是日历日时,它不会显示特定的日子。我假设我做错了。更好的解决方法将不胜感激。
日历日链接:
<td align="right"><a id="c0408" href="#"> 8</a></td>
天气历史:
<div id="allhistory">
<div id="hc0408" style="display:none">
<ul>
<li class="dateheader">April 8, 2007</li>
<li>The Savannah Airport drops to 28 degrees, its lowest April
temperature.</li>
<li class="dateheader">April 8, 2007</li>
<li>Summerville has their coldest April temperature, when the mercury
falls to 27 degrees.</li>
</ul>
</div>
<div id="hc0409" style="display:none">
<ul>
<li class="dateheader">April 9, 2011</li>
<li>Severe thunderstorms impact Berkeley County in South Carolina,
with hail as large as tennis balls (2.5 inches) and winds as
high as 64 mph.</li>
</ul> <!-- 0409 -->
</div>
</div> <!-- all history div -->
jQuery代码:
<script>
$(document).ready(function() {
$('#calendar a').click(function() {
var dateid = $(this).attr('id');
var selection = "div#h"+dateid;
$("selection").show();
})
});
</script>