﻿<!DOCTYPE html>
<html lang="en">
<head>
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>FtvStory - 會員管理系統</title> 
    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="description" content="Time of Madness, Red Stains the World">
    
  <link href="static/css/notice_view.build.css" rel="stylesheet">
    <style type="text/css">
    <!--
    .STYLE1 {
      color: #565555;
    }

    .table-c table td {
      font-size: 16px;
      color:#fff;
      padding: 15px 5px 1px 1px;
      border-bottom-width: 0px;
      border-top-style: none;
      border-right-style: none;
      border-bottom-style: solid;
      border-left-style: none;
      border-bottom-color: #e3d6d6;
    }

    .table-c table a {
      text-decoration: none;
      color: #ff0000;
    }

    .banklist ul {
      position: relative;
    }

    .STYLE3 {
      font-size: 16px;
      color: green;
    }
    
    .STYLE2 {
      font-size: 16px;
      color: #c98f06;
    }
 .drag{
            width: 60%;
            height: 40px;
            left:0px;
            line-height: 40px;
            background-color: #5f5f5f;
            position: relative;
            margin:0 auto;
        }
        .bg{
            width:40px;
            height: 100%;
            position: absolute;
            background-color: #75CDF9;
        }
        .text{
            position: absolute;
            width: 100%;
            height: 100%;
            text-align: center;
            user-select: none;
        }
        .btn{
            width:40px;
            height: 38px;
            position: absolute;
            border:1px solid #ccc;
            cursor: move;
            text-align: center;
            background-color: #fff;
            user-select: none;
            color:#666;
        }
    -->
  </style>
</head>
<body>

  <div class="body-wrap">
	  <div id="head"></div>
    <div class="page-wrap page-scroller">
      <div class="bg-page-wrap bg-fixed" id="bg-page-view"></div>
      <div class="container container-col8" id="notice-view-content">
        <div class="news-view-wrap">
          <div class="news-view-head">

            <h5 class="news-view-date"></h5>
            <h3 class="news-view-headline"></h3>
          </div>
          <div class="news-view-body">
            <div class="inner">
                <h2>會 員 管 理</h2>
                <div id="table-c" class="table-c">
                  <table width="80%" border="0" align="center" cellpadding="0" cellspacing="1">
                    <form name="f1" action="" method="post" onSubmit="return checkfrom(this)">
                        <tr>
                          <td align="left">
                            <input name="username" type="text" id="username" class="app_input" maxlength="20"
                              style="width:98%; height:40px; font-size:16px;" placeholder="用戶名"/>
                            
                          </td>
                        </tr>
                        <tr>
                          <td align="left">
                            <span class="error-message" id="username-error"style="color:orange"></span>
                          </td>
                        </tr>
                        <tr>
                          <td align="left">
                            <input name="passwd" type="password" id="passwd" class="app_input" maxlength="50"
                              style="width:98%; height:40px; font-size:16px;" placeholder="密碼"/>
                          </td>
                        </tr>
                         <tr>
                          <td align="left">
                            <span class="error-message" id="passwd-error" style="color:orange"></span>
                          </td>
                        </tr>
                        <tr>
                         <td align="left">
       										 <div class="am-form-group">
								             <div class="drag">
               								<div class="bg"></div>
               								<div class="text" id="testify" onselectstart="return false;">拖動滑塊驗證</div>
               									<div class="btn">&gt;&gt;</div><br>                            
             								</div>
 													 </div>
                   
                         </td>
                        </tr>
                        
 
                        <tr>
                          <td align="center" height="30px;"></td>
                        </tr>
                        <tr>

                          <input type="hidden" name="ptype" value="login" id="faceValue" />
                          <input type="hidden" name="logincode" value="" id="logincode"/>
                          <td height="30" align="left">
                            <input name="Submit" type="submit" class="btn2 " value="登  陸"
                              style="width:98%; height:50px;cursor:pointer; font-size:16px;background-color:red;color:#fff;font-weight:bold;" />
                          </td>
                        </tr>
                        <tr>
                         <td align="left">
                          
                          <ul>
                          	<li>首次來訪?<a href="member.aspx" class="pull-right"> 創建賬號</a></li>
                          	</ul>
                          </td>
                        </tr>
                        
                    </form>
                    
                  </table>
                  
                </div>
              
            </div>
          </div>
          <div class="news-preview-wrap">

          </div>

        </div>
      </div>
      
    </div><!-- page wrap -->
    
    <div id="footer"></div>
  </div><!-- body-wrap -->

</body>
</html>
<script type="text/javascript">
  function back() {
    document.forms.f1.action = "members.aspx";
    document.forms.f1.submit();
  }
</script>
<script defer src="static/js/vendors.bundle.js"></script>
<script src="static/js/jquery-3.4.1.min.js"></script>
<script defer src="static/js/notice_view.bundle.js"></script>
<script
  type="text/javascript">$('#head').load('../center/head.html'); 
  $('#footer').load('../center/footer.html'); 
</script>
  
<script>
    function validateUsername() {
      var username = document.getElementById('username').value;
      var usernameRegex = /^[a-zA-Z0-9]{6,12}$/;

      if (username == '') {
        document.getElementById("username-error").innerHTML = "賬號不能為空";

      } else if (!usernameRegex.test(username)) {
        document.getElementById("username-error").innerHTML = "賬號須包含6-12位字母和數字";
      } else {
        document.getElementById("username-error").innerHTML = "";
      }
    }

    function validatePassword() {
      var password = document.getElementById('passwd').value;
      var passwordRegex = /^[a-zA-Z0-9]{6,20}$/;

      if (password == '') {
        document.getElementById("passwd-error").innerHTML = "密碼不能為空";
      } else if (!passwordRegex.test(password)) {
        document.getElementById("passwd-error").innerHTML = "密碼須包含6-20位字母和數字";
      } else {
        document.getElementById("passwd-error").innerHTML = "";
      }
    }

    document.getElementById('username').addEventListener('blur', validateUsername);
    document.getElementById('passwd').addEventListener('blur', validatePassword);
</script>
  
    <script>
     //一、定义一个获取DOM元素的方法
        var $ = function(selector){
                return  document.querySelector(selector);
            },
            box = $(".drag"),//容器
            bg = $(".bg"),//背景
            text = $(".text"),//文字
            btn = $(".btn"),//滑块
            success = false,//是否通过验证的标志
            distance = box.offsetWidth - btn.offsetWidth;//滑动成功的宽度（距离）

        //二、给滑块注册鼠标按下事件
        btn.onmousedown = function(e){

            //1.鼠标按下之前必须清除掉后面设置的过渡属性
            btn.style.transition = "";
            bg.style.transition ="";

            //说明：clientX 事件属性会返回当事件被触发时，鼠标指针向对于浏览器页面(或客户区)的水平坐标。

            //2.当滑块位于初始位置时，得到鼠标按下时的水平位置
            var e = e || window.event;
            var downX = e.clientX;

            //三、给文档注册鼠标移动事件
            document.onmousemove = function(e){

                var e = e || window.event;
                //1.获取鼠标移动后的水平位置
                var moveX = e.clientX;

                //2.得到鼠标水平位置的偏移量（鼠标移动时的位置 - 鼠标按下时的位置）
                var offsetX = moveX - downX;

                //3.在这里判断一下：鼠标水平移动的距离 与 滑动成功的距离 之间的关系
                if( offsetX > distance){
                    offsetX = distance;//如果滑过了终点，就将它停留在终点位置
                }else if( offsetX < 0){
                    offsetX = 0;//如果滑到了起点的左侧，就将它重置为起点位置
                }

                //4.根据鼠标移动的距离来动态设置滑块的偏移量和背景颜色的宽度
                btn.style.left = offsetX + "px";
                bg.style.width = offsetX + "px";

                //如果鼠标的水平移动距离 = 滑动成功的宽度
                if( offsetX == distance){

                    //1.设置滑动成功后的样式
                    text.innerHTML = "驗證成功";
                    text.style.color = "#fff";
                    btn.innerHTML = "&radic;";
                    btn.style.color = "green";
                    bg.style.backgroundColor = "lightgreen";

                    //2.设置滑动成功后的状态
                    success = true;
                    //成功后，清除掉鼠标按下事件和移动事件（因为移动时并不会涉及到鼠标松开事件）
                    btn.onmousedown = null;
                    document.onmousemove = null;

                    //3.成功解锁后的回调函数
                  var oldElement = document.getElementById("logincode");
                        oldElement.value="+logincode+";
                }
            }

            //四、给文档注册鼠标松开事件
            document.onmouseup = function(e){

                //如果鼠标松开时，滑到了终点，则验证通过
                if(success){
                    return;
                }else{
                    //反之，则将滑块复位（设置了1s的属性过渡效果）
                    btn.style.left = 0;
                    bg.style.width = 0;
                    btn.style.transition = "left 1s ease";
                    bg.style.transition = "width 1s ease";
                }
                //只要鼠标松开了，说明此时不需要拖动滑块了，那么就清除鼠标移动和松开事件。
                document.onmousemove = null;
                document.onmouseup = null;
            }


        }
        </script>
