$(function () { $("#confirmpassword").click(function () { var pwd = $("#txtPwd").val(); layer.open({ type: 1 , title: '請輸入登入密碼' , closeBtn: false , area: '350px;' , shade: 0.8 , id: 'LAY_layuipro' //設定一個id,防止重復彈出 , btn: ['保存','關閉'] , btnAlign: 'c' , moveType: 1 //拖拽模式,0或者1 , content:'<div style="padding: 30px 20px;; line-height: 22px; background-color: #393D49; color: #fff; font-weight: 300;">密碼:<input id="firstpwd" type="password" placeholder="請輸入密碼"></div>'//彈出的子頁面 , yes: function (index, layero) {
//獲取輸入框內容 var oldPass=layero.find('#firstpwd'); var pass = $(oldPass).val(); var pwd = $("#txtPwd").val(); //var jmpwd = hex_md5(pass).toUpperCase();//這是MD5加密 alert(pwd); alert(pass); alert(jmpwd); if (pwd == jmpwd) { myfunction(); } else { alert("密碼錯誤"); } layer.close(index); }, cancel: function (index) { layer.close(index); } }); }); });