gpt4 book ai didi

javascript - 如何在javascript中禁用日历扩展器中的上一个日期

转载 作者:行者123 更新时间:2023-11-30 00:14:41 25 4
gpt4 key购买 nike

我想在日历扩展器中禁止以前的日期。我可以在选择上一个日期时显示弹出窗口,但文本框未清除。

<script type="text/javascript">
function checkDate(sender, args) {
if (sender._selectedDate < new Date()) {
alert("You cannot select a day earlier than today!");
sender._selectedDate = new Date();
sender._textbox.set_Value(sender._selectedDate.format(sender._format))
document.getElementById("txtNextFollowupDate").value = "";//want to make empty
}
}
</script>

<tr>
<td><asp:Label ID="Label18" Text="Next Follow up date" runat="server"></asp:Label></td>
<td>:</td>
<td>
<asp:TextBox runat="server" ID="txtNextFollowupDate" />
<asp:CalendarExtender ID="CalendarNextFollowUpDate" runat="server" TargetControlID="txtNextFollowupDate" OnClientDateSelectionChanged="checkDate" > </asp:CalendarExtender>
</td>
</tr>

最佳答案

您需要使用 Clear Textbox 值:

document.getElementById("<%=txtNextFollowupDate.ClientID %>").value=" ";

关于javascript - 如何在javascript中禁用日历扩展器中的上一个日期,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35172079/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com