1
我使用AJAX calendarextender和JavaScript來限制用戶不會選擇過去的日期,但在這裏,我要面對的一個問題以前的日期:如果用戶選擇阿賈克斯日曆擴展不要選擇
- 過去的日期,那麼它工作正常
- 如果用戶選擇將來的日期,那麼也是它工作正常
但如果用戶選擇當前日期,那麼也是他越來越警惕這是不要求d。
我的要求是,用戶可以選擇當前日期加上未來的日期,但限制輸入任何以前的日期。請幫我解決這個問題,下面你可以找到的代碼: -
<div id="formload" >
<!-- ============================== Fieldset 1 ============================== -->
<fieldset>
<legend>Enter Date</legend>
<table>
<tr>
<td><label for="input-one" class="float"><strong>Date</strong></label>
</td><br />
<td><asp:TextBox ID="txtDate" runat="server" CssClass="inp-text" Width="300px"></asp:TextBox> </td>
<td><asp:Image runat="server" ID="btnDate2" AlternateText="cal2" ImageUrl="~/App_Themes/Images/icon_calendar.jpg" />
<ajaxtoolkit:calendarextender runat="server" ID="calExtender2" Format="dddd, MMMM dd, yyyy" PopupButtonID="btnDate2" TargetControlID="txtDate" OnClientDateSelectionChanged="CheckDateEalier" /> </td>
</tr></table>
</fieldset>
<!-- ============================== Fieldset 1 end ============================== -->
的Javascript
<script type="text/javascript">
function CheckDateEalier(sender, args)
{
if (sender._selectedDate < new Date())
{
alert("Day earlier than today cannot be selected.");
sender._selectedDate = new Date();
sender._textbox.set_Value(sender._selectedDate.format(sender._format))
}
}
</script>
功能CheckDateEalier(發件人,參數) { 變種TODATE =新日期(); toDate.setMinutes(0); toDate.setSeconds(0); toDate.setHours(0); toDate.setMilliseconds(0); if(sender._selectedDate
Dharmendra