Friday, 1 July 2016

JavaScript - check if date is valid

Watch this example on YouTube

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="JavaScript Check if date is valid.aspx.cs" Inherits="WebTest.JavaScript_Check_if_date_is_valid" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script type="text/javascript">
        if (Date.parse("1/1/2000")) {
            alert("Valid Date")
        }
        else {
            alert("Invalid Date")
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="ValidateDate();" />
    </div>
    </form>
</body>
</html>

No comments:

Post a Comment