254 js获取cookie及判断字符串长度

一、 
$.cookie('key', 'value', { expires: expire_time, path: '/' });
                alert('设置成功!');
过期时间expire_time单位是:天,注意这个!

二、
if(str.replace(/\s*/g, '').split('').length != 6) {
                    alert('字符串str长度必须是6位,请确认!');
                    return false;
                }

本文来自两位大佬:邯郸贾氏和大帅!

猜你喜欢

转载自blog.csdn.net/phpstory/article/details/115169114