Javascript Check doesn't work

i wrote this:

    <%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" Inherits="Register" Codebehind="Register.aspx.cs" %>
<asp:Content ID="Content1" ContentPlaceHolderID="myMainPage" runat="server">
 <script type="text/javascript">
       function checkInput() {
         var isInputCorrect = true;
         var Name = document.getElementById("<%=UserName.ClientID %>").value;
         var email = document.getElementById("<%=email.ClientID %>").value;
         var password = document.getElementById("<%=Password.ClientID %>").value;
         $(document).ready(function () {
             if (Name.length > 5) {
                 if ((email.length > 6) && (email.indexOf('@') != -1)) {
                     if (password.length < 5) {
                         alert("Password is too short, try again");
                         isInputCorrect = false;
                     }
                 }
                 else {
                     alert("E-mail is invaild");
                     isInputCorrect = false;
                 }
             }
             else {
                 alert("Username is too short, try again");
                 isInputCorrect = false;
             }
         });
         if (!isInputCorrect) {
             location.href = "register.aspx";

         }
         return (isInputCorrect);
     }
    </script>
        <form id="Form2" runat="server">
        <div id="Signup">
            <asp:TextBox ID="UserName" MaxLength="20" runat="server" CssClass="username" TextMode="SingleLine" value="Username" onClick="this.value=''"></asp:TextBox>
            <asp:TextBox ID="email" MaxLength="20" runat="server" CssClass="Email" TextMode="SingleLine" value="Email" onClick="this.value=''"></asp:TextBox>
            <asp:TextBox ID="Password" runat="server" CssClass="password" TextMode="Password" value="Password" onClick="this.value=''"></asp:TextBox>
            <asp:Button ID="RegisterButt" runat="server" Text="Register" OnClientClick="javascript:return checkInput();" onclick="RegisterButt_Click" />

        </div>
    </form>
</asp:Content>

but this wont get in the "Chekinput" function, ideas anyone? i sended the values of the labeles in the button command, i can't get it why it couldn't work

Answers:

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.