JQuery_jquery 기반 쿠키 플러그인

WBOY
풀어 주다: 2016-05-16 18:30:03
원래의
1118명이 탐색했습니다.
간단한 사용법:
코드 복사 코드는 다음과 같습니다.



JQuery-쿠키 플러그인<br><script type="text/javascript" src="jquery-1.4.js"><script type="text/javascript" src="jquery.cookie.js"></script> <BR><script type="text/javascript" src="/js/jquery.3.5.2.min.m.js"></script> </head><div style="position: fixed;right: 0;top:100px;width: 125px; z-index:2000;"><div ><a target="_blank" rel="nofollow" href="https://www.520xingyun.com/from/188bet.php" ><img width="120px" height="550px" src="https://www.520xingyun.com/images/188_120.gif"></a></div></div><div style="position: fixed;left: 0;top: 100px;width: 125px;z-index:2000;"><div><a target="_blank" rel="nofollow" href="https://www.520xingyun.com/from/188bet.php"><img width="120px" height="550px" src="https://www.520xingyun.com/images/188_120.gif"></a></div></div> ; <BR><a href="#">쿠키1 설정</a><br> <BR><a href="#">쿠키2 설정</a><br> <a href="#">쿠키 가져오기</a><br> <BR><a href="#">쿠키 삭제</a><br> <BR></body> ; <BR></html> <BR><script type="text/javascript"> <BR>$(function(){ <BR>var COOKIE_NAME = 'test_cookie'; <BR>//쿠키 설정 , 통과 시간 간격<BR>$('a').eq(0).click(function() { <BR>$.cookie(COOKIE_NAME, 'test', { 경로: '/', 만료: 1 }) ; <BR>return false; <BR>}); <BR>// 쿠키 만료 시간 설정 <BR>$('a').eq(1).click(function() { <BR>var date = new Date (); <BR>date.setTime(date.getTime() (1 * 24 * 60 * 60 * 1000)) <BR>$.cookie(COOKIE_NAME, 'test', { 경로: '/', 만료: 날짜 }); <BR>return false; <BR>// 쿠키 가져오기 <BR>$('a').eq(2).click(function() { <BR>alert ($ .cookie(COOKIE_NAME)); <BR>return false <BR>}) <BR>// 쿠키 삭제 <BR>$('a').eq(3).click(function() { <BR> $.cookie(COOKIE_NAME, null, { 경로: '/' }) <BR>return false <BR>}) <BR></script> > <BR><BR>플러그인의 소스 코드도 매우 간단합니다. <BR> <BR><BR></script>

코드 복사
value = ''
options.expires =
}
var 만료 = ''; if (options .expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
var date
if (typeof options.expires = = '숫자') {
date = new Date();
date.setTime(date.getTime() (options.expires * 24 * 60 * 60 * 1000)) else {
date = options.expires;
}
expires=' date.toUTCString();
}
var path = options.path ? 경로) : ''; var domain = options.domain=' (options.domain) : '' var secure = options.secure' : ''; >document.cookie = [이름, '=' , encodeURIComponent(값), 만료, 경로, 도메인, 보안].join('')
} else {
var cookieValue =
if; (document.cookie && document.cookie != ' ') {
var cookie = document.cookie.split(';')
for (var i = 0; i < cookie.length; i ) {
var cookie = jQuery.trim(cookie[i])
if (cookie.substring(0, name.length 1) == (name '=')) {
cookieValue = decodeURIComponent( cookie.substring(name.length 1));
break;
}
}
return cookieValue
}



쿠키 플러그인


다음을 참조할 수도 있습니다.

jquery 쿠키 플러그인 코드 클래스
관련 라벨:
원천:php.cn
본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
최신 이슈
인기 튜토리얼
더>
최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿
회사 소개 부인 성명 Sitemap
PHP 중국어 웹사이트:공공복지 온라인 PHP 교육,PHP 학습자의 빠른 성장을 도와주세요!