我设计了一个下拉日历,但是如果我单击图像以显示下拉日历,我在文本框下方看不到它。如何在文本框下方显示此日历:
<table width=100%>
<tr align=center>
<td align=center>
<asp:Panel ID="Panel2" runat="server" GroupingText="Suche" >
<table width=100%>
<tr align=center>
<td align=center>
<asp:Label ID="Label4" runat="server" Text="Von :"></asp:Label>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<img id="Calimg1" src="Images/cal.jpg" onclick="selectdate()" />
<div id="calblock1" class=calander >
<asp:Calendar OnSelectionChanged="Calendar1_SelectionChanged"
ID="Calendar1" runat="server" BackColor="#FFFFCC"
BorderColor="#FFCC66" BorderWidth="1px"
DayNameFormat="Shortest" Font-Names="Verdana"
Font-Size="8pt" ForeColor="#663399" Height="200px"
ShowGridLines="True" Width="220px">
<DayHeaderStyle BackColor="#FFCC66" Font-Bold="True"
Height="1px" />
<NextPrevStyle Font-Size="9pt" ForeColor="#FFFFCC" />
<OtherMonthDayStyle ForeColor="#CC9966" />
<SelectedDayStyle BackColor="#CCCCFF" Font-Bold="True" />
<SelectorStyle BackColor="#FFCC66" />
<TitleStyle BackColor="#990000" Font-Bold="True"
Font-Size="9pt" ForeColor="#FFFFCC" />
<TodayDayStyle BackColor="#FFCC66" ForeColor="White" />
</asp:Calendar>
</div>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1"
runat="server"
ControlToValidate="TextBox1"
ErrorMessage="*" ForeColor="Red">
</asp:RequiredFieldValidator>
</td>
</tr>
......
CSS:
.calander
{
display:none;
position:absolute
}
和我使用的 JavaScript:
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$('#Calimg1').click(function () {
if (isAnyVisible()) return false;
$('#calblock1').slideToggle("slow");
});
$('#Img1').click(function () {
if (isAnyVisible()) return false;
$('#Div2').slideToggle("slow");
});
});
function isAnyVisible() {
if ($('#Calimg1').is(':visible') || $('#Img1').is(':visible')) {
return false;
}
return true;
}