<input type="text" name="password" id="LAY-user-login-password" placeholder="明码" class="layui-input no-ime" autocomplete="off" onpaste="return false" ondragenter="return false" oncontextmenu="return false;" style="ime-mode:disabled;font-weight: 800"><input class="password" type="hidden" name="password" id="">
$('#LAY-user-login-password').bind('input', function (e) {        var that = $(this);        var ind = this.selectionStart * 1;        var val = that.val();        function keydel() {          window.onkeydown = function (e) {            if (e.keyCode == 8 && ind == 1 && val.length == 1) {              str = str[0]            } else {              str = val            }          }        }        // 不容许输出中文        for (var i = 0; i < val.length; i++) {          if (val.charCodeAt(i) > 0 && val.charCodeAt(i) < 255) {            $(this).val('')          }        }        if (val.replace(/[\u4e00-\u9fa5]/img, '')) {          $(this).val(val.replace(/[\u4e00-\u9fa5]/img, ''))        }        if (val.length == 0) {          str = ""        }        if (ind == val.lenth) {          str += val[ind - 1]        } else {          if (str.length == val.length) {            str = str          }          else if (str.length > val.length) {            if (val.slice(0, ind) != 'undefined' && val.slice(ind + 1) != 'undefined') {              // 如果是从两头删除(两头字母)              // window.onkeydown = function (e) {              if (keyCode == 8 && ind == 1 && val.length == 1) {                // 一次性删除所有                str = str[0]              } else if (ind == 1 && val.length == 1) {                // 一次性抉择所有不按删除键,间接填写                str = val              } else if (str.length - val.length != 1) {                // 删除某一段明码                str = str.slice(0, ind) + str.slice(ind + str.length - val.length)              } else {                // 只删除两头的某一个                str = str.slice(0, ind) + str.slice(ind + 1)              }            } else if (val.slice(0, ind - 1) == 'undefined' && val.slice(ind - 1) != 'undefined') {              // 如果是删除第一个字母              str = str.slice(ind - 1)            } else if (val.slice(0, ind - 1) != 'undefined' && val.slice(ind - 1) == 'undefined') {              // 如果是删除最初一个字母              str = str.slice(0, ind - 1)            } else if (val.slice(0, ind - 1) == 'undefined' && val.slice(ind - 1) == 'undefined') {              // 如果删除所有字母              str = ""            }          } else {            // 加            if (val.slice(0, ind - 1) != 'undefined' && val.slice(ind - 1) != 'undefined') {              // 如果是从两头输出(两头字母)                if (val.length - str.length != 1) {                // 加多位明码                str = str.slice(0, ind - 1) + val.slice(ind - (val.length - str.length))              } else {                // 如果是从两头输出(两头字母)                str = str.slice(0, ind - 1) + val[ind - 1] + str.slice(ind - 1);              }            } else if (val.slice(0, ind - 1) == 'undefined' && val.slice(ind - 1) != 'undefined') {              // 如果是第一个字母后面输出(第一个字母)              str = val[ind - 1] + str.slice(ind - 1);            } else if (val.slice(0, ind - 1) != 'undefined' && val.slice(ind - 1) == 'undefined') {              // 如果是最初输出(最初一个字母)              str = str.slice(0, ind - 1) + val[ind - 1];            } else if (val.slice(0, ind - 1) == 'undefined' && val.slice(ind - 1) == 'undefined') {              // 如果是第一次输出(第一个字母)              str = val[0]            }          }        }        $('.password').val(str)        //input的value值转化为·        $(this).val($(this).val().replace(/./g, '.'))      })