<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="default.aspx.cs" Inherits="Web.share.wechat.wechatbind._default" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
 <title></title>
<meta name="format-detection" content="telephone=no" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<link type="text/css" rel="stylesheet" href="/css/reset.css" />
<link type="text/css" rel="stylesheet" href="/css/base.css" />
<script type="text/javascript" src="/js/touch.js"></script>
<script type="text/ecmascript" src="/js/md5.js"></script>
  <script src="/m/js/modernizr.custom.js"></script>
<script type="text/javascript">
    window.onload = function () {

        var oInput = document.getElementById('tbPassword_lan');
        oInput.value = '';
        oInput.onkeyup = function () {
            //强度状态设为默认
            document.getElementById('tbPassword_lan').style.color = "grey";
            var pwd = this.value;
            var result = 0;
            for (var i = 0, len = pwd.length; i < len; ++i) {
                result |= charType(pwd.charCodeAt(i));
            }

            var level = 0;
            //对result进行四次循环，计算其level
            for (var i = 0; i <= 4; i++) {
                if (result & 1) {
                    level++;
                }
                //右移一位
                result = result >>> 1;
            }
            if (pwd.length >= 6) {
                switch (level) {
                    case 1:
                        document.getElementById('tbPassword_lan').style.color = "red";
                        break;
                    case 2:
                        document.getElementById('tbPassword_lan').style.color = "orange";
                        break;
                    case 3:
                        document.getElementById('tbPassword_lan').style.color = "blue";
                        break;
                    case 4:
                        document.getElementById('tbPassword_lan').style.color = "green";
                        break;
                }
            }
        }
    }
    /*
        定义一个函数，对给定的数分为四类(判断密码类型)，返回十进制1，2，4，8
        数字 0001 -->1  48~57
        小写字母 0010 -->2  97~122
        大写字母 0100 -->4  65~90
        特殊 1000 --> 8 其它
    */
    function charType(num) {
        if (num >= 48 && num <= 57) {
            return 1;
        }
        if (num >= 97 && num <= 122) {
            return 2;
        }
        if (num >= 65 && num <= 90) {
            return 4;
        }
        return 8;
    }
</script>


</head>
<body>
    <form id="form1" runat="server">
        <div class ="login ">

            <asp:Label ID="Label1" runat="server" Text="绑定账写"></asp:Label>
        </div>
        <div class ="login ">
        
                      <asp:TextBox ID="tbUserName_lan" runat="server" MaxLength="25" placeholder="人员编号/登录名/邮箱/电话" 
                CssClass="login-field login-field-password"></asp:TextBox>

      </div>
        <div class ="login ">
      <asp:TextBox ID="tbPassword_lan" runat="server" placeholder="请输入密码" onblur="cal()" onfocus="c()"
                    TextMode="Password" CssClass="login-field login-field-password"></asp:TextBox>  
      </div>
        <div class="tab-iteam" >
    <div class="tab-iteam-con">
    	<div class="con" style="margin-top:30px">
                    <asp:LinkButton ID="btForget" runat="server" onclick="btForget_Click" Text="绑定" 
                           CssClass="more" ValidationGroup="lan" />

		</div>
    </div>
</div>
        <div style =" text-align :center; font-size :12px;   margin-bottom :30px; margin-top :10px; ">
            <asp:Label ID="lbOpenid" runat="server" Visible ="false" ></asp:Label>
   <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                                    ControlToValidate="tbUserName_lan" Display="Dynamic" ErrorMessage="请输入登录名。" 
                                    ValidationGroup="lan" ForeColor="Red"></asp:RequiredFieldValidator>
                                <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" 
                                    ControlToValidate="tbUserName_lan" Display="Dynamic" ErrorMessage="登录名不合规范。" 
                                    ValidationExpression="^[^%&gt;&lt;'&amp;*=!&quot;?]{2,25}$" 
                                    ValidationGroup="lan" ForeColor="Red"></asp:RegularExpressionValidator>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                                    ControlToValidate="tbPassword_lan" Display="Dynamic" ErrorMessage="请输入密码。" 
                                    ValidationGroup="lan" ForeColor="Red"></asp:RequiredFieldValidator>
        </div>
    </form>
</body>
</html>
<script type="text/javascript">  
    function cal() {
        var t1 = document.getElementById("<%=tbPassword_lan.ClientID%>").value;
        if (t1.trim().length > 5) {
            var hash = hex_md5(t1);
            var tbcolor = document.getElementById('tbPassword_lan').style.color;
            switch (tbcolor) {
                case 'red':
                    hash = hash + '1';
                    break;
                case 'orange':
                    hash = hash + '2';
                    break;
                case 'blue':
                    hash = hash + '3';
                    break;
                case 'green':
                    hash = hash + '4';
                    break;
            }
            document.getElementById("<%=tbPassword_lan.ClientID%>").value = hash;
        }
        else {
            if (document.getElementById("<%=tbUserName_lan.ClientID%>").value != "") 
            alert("请输入正确的密码");
        }
    }
</script>  
<script type="text/javascript">  
    function c() {
        document.getElementById("<%=tbPassword_lan.ClientID%>").value = "";
    }
</script>  