<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default4.aspx.cs" Inherits="Default4" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script language="javascript">
        function chk() {
        var y
            var txt1 = parseInt(document.getElementById("<%=txt1.ClientID %>").value);
            var txt2 = parseInt(document.getElementById("<%=txt2.ClientID %>").value);
            if ((txt1 > 140) && (txt1 < 159) && (txt2 > 90) && (txt2 < 99)) {
                document.getElementById("tt").innerHTML = " ";
                y= true;
            }
            else if ((txt1 > 160) && (txt1 < 179) && (txt2 > 100) && (txt2 < 109)) {
                document.getElementById("tt").innerHTML = " ";
                y= true;
            }
            else if ((txt1 > 180) && (txt1 < 209) && (txt2 > 110) && (txt2 < 119)) {
                document.getElementById("tt").innerHTML = " ";
                y= true;
            }
            else if ((txt1 > 210) && (txt2 > 120)) {
                document.getElementById("tt").innerHTML = " ";
                y= true;
            }
            else {
                document.getElementById("tt").innerHTML = " ";
                y= false;
            }
            return y;
        }
        function validateLength(oSrc, args) {
                    var txt1 = parseInt(document.getElementById("<%=txt1.ClientID %>").value);
                    var txt2 = parseInt(document.getElementById("<%=txt2.ClientID %>").value);

                    args.IsValid = ((txt1 > 140) && (txt1 < 159) && (txt2 > 90) && (txt2 < 99)) ||((txt1 > 160) && (txt1 < 179) && (txt2 > 100) && (txt2 < 109)) || ((txt1 > 180) && (txt1 < 209) && (txt2 > 110) && (txt2 < 119)) || ((txt1 > 210) && (txt2 > 120)) ;
                    
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
        <asp:TextBox ID="txt1" runat="server"></asp:TextBox>
        <br />
        <asp:TextBox ID="txt2" runat="server"></asp:TextBox>

        <br />
        
    
        <br /><asp:Button ID="Button1" runat="server" Text="chk" OnClientClick="chk();" 
            onclick="Button1_Click"  Width="72px" />
<asp:CustomValidator id="CustomValidator1" runat="server" 
      ControlToValidate = "txt2"
      ErrorMessage = "You must enter at least 8 characters!"
   ClientValidationFunction="validateLength" >
</asp:CustomValidator>

    </div>
    
    </form><div style="position:absolute; top: 72px; left: 669px; width: 159px; height: 70px;" id="tt"></div>
</body>
</html>

