JS Cookies
function SetCookie(name, value) {
document.cookie = name + "=" + escape(value);
}
function getCookie(name) {
var arr = document.cookie.match(new RegExp("(^| )" + name + "=([^;]*)(;|$)"));
if (arr != null) {
return unescape(arr[2]);
}
return null;
}
var count = getCookie(mobile);
if (!count) {
count = 1;
}
else {
if (count > 2) {
alert("已连续使用超过3次,请稍后再试!");
return false;
}
}
count = parseInt(count) + 1;
SetCookie(mobile, count);