ASP. NET jQuery instance 14 verifies the time range in ASP. NET form

Source: Internet
Author: User

: Http://jqueryui.com/download,themeselect sunny
Interface code: Copy codeThe Code is as follows: <form id = "form1" runat = "server">
<Div align = "center">
<Fieldset style = "width: 400px; height: 150px">
<Table border = "0" cellpadding = "3" cellspacing = "3">
<Tr>
<Td colspan = "2">
Enter the date range:
</Td>
</Tr>
<Tr>
<Td>
Start Time:
</Td>
<Td>
<Asp: TextBox ID = "txtStartDate" runat = "server"> </asp: TextBox>
</Td>
</Tr>
<Tr>
<Td>
End Time:
</Td>
<Td>
<Asp: TextBox ID = "txtEndDate" runat = "server"> </asp: TextBox>
</Td>
</Tr>
<Tr>
<Td colspan = "2">
<Asp: Button ID = "btnSubmit" runat = "server" Text = "Submit"/> <asp: Button ID = "btnReset" runat = "server"
Text = "reset"/>
</Td>
</Tr>
</Table>
</Fieldset>
</Div>
</Form>

Script code:Copy codeThe Code is as follows: <Title> Recipe14 </title>
<Link rel = "Stylesheet" href = "Styles/sunny/jquery-ui-1.8.17.custom.css"/>
<Script type = "text/javascript" src = "Scripts/jquery-1.4.1-vsdoc.js"> </script>
<Script type = "text/javascript" src = "Scripts/jquery-ui-1.8.17.custom.min.js"> </script>
<Script type = "text/javascript">
$ (Function (){
$ ("# TxtStartDate"). datepicker ();
$ ("# TxtEndDate"). datepicker ();

$ ("# BtnSubmit"). click (function (e ){
E. preventDefault ();
Var startdate = Date. parse ($ ("# txtStartDate"). val ());
Var enddate = Date. parse ($ ("# txtEndDate"). val ());

If (startdate> enddate ){
Alert ("the start time cannot be later than the end time! ");
}
});

$ ("# BtnReset"). click (function (e ){
E. preventDefault ();
$ ("# TxtStartDate"). val ("");
$ ("# TxtEndDate"). val ("");
});
});
</Script>
</Head>

Final interface:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.