Commit 3fe513fe by doszhang

dos

parent 5359b6e6
...@@ -277,8 +277,16 @@ $(document).ready(function () { ...@@ -277,8 +277,16 @@ $(document).ready(function () {
$('.personal-page .btn-next').on('click', showSuggestPage); $('.personal-page .btn-next').on('click', showSuggestPage);
//署名输入框限制长度事件 //署名输入框限制长度事件
$('.suggest-page input[name=signature]').on('input propertychange', inputLength); $('.suggest-page input[name=signature]').on('input propertychange', inputLength);
//署名输入框聚焦判断有没有勾选同意
$('.suggest-page input[name=signature]').on('focus', checkAgree);
}); });
function checkAgree() {
if (!agreeSuggestion) {
$('.agree-wrap').addClass('animate');
}
}
function inputLength() { function inputLength() {
checkIt('signature', 12); checkIt('signature', 12);
} }
...@@ -603,29 +611,32 @@ function swapArray(arr, index1, index2) { ...@@ -603,29 +611,32 @@ function swapArray(arr, index1, index2) {
} }
function checkIt(bind, maxNum) { function checkIt(bind, maxNum) {
var v = document.getElementById(bind).value; if (agreeSuggestion) {
var v = document.getElementById(bind).value;
if (v == "") {
return [];
}
var len = 0; //中英字符长度计数 if (v == "") {
//计算 return [];
for (i = 0; i < v.length; i++) {
var c = v.charCodeAt(i);
if ((c >= 0x0001 && c <= 0x007e) || (0xff60 <= c && c <= 0xff9f)) //英文字母状态
{
len++;
} else //中文状态
{
len += 2;
} }
if (len >= maxNum) {
if (i != v.length - 1) { var len = 0; //中英字符长度计数
$("#" + bind).val(v.substr(0, i + 1)) //计算
break; for (i = 0; i < v.length; i++) {
var c = v.charCodeAt(i);
if ((c >= 0x0001 && c <= 0x007e) || (0xff60 <= c && c <= 0xff9f)) //英文字母状态
{
len++;
} else //中文状态
{
len += 2;
}
if (len >= maxNum) {
if (i != v.length - 1) {
$("#" + bind).val(v.substr(0, i + 1))
break;
}
} }
} }
} else {
$("#" + bind).val(v.substr(0, 0));
} }
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment