var
Cookies = {};
Cookies.set =
function
(name, value){
var
argv = arguments;
var
argc = arguments.length;
var
expires = (argc > 2) ? argv[2] : null;
if
(expires != null){
var
exp
=
new
Date
();
exp
.setTime(
exp
.getTime() + 8*3600 + expires);
}
alert(
exp
.toGMTString());
var
path = (argc > 3) ? argv[3] :
'/'
;
var
domain = (argc > 4) ? argv[4] : null;
var
secure = (argc > 5) ? argv[5] : false;
document.cookie = name +
"="
+ escape (value) +
((expires == null) ?
""
: (
"; expires="
+
exp
.toGMTString())) +
((path == null) ?
""
: (
"; path="
+ path)) +
((domain == null) ?
""
: (
"; domain="
+ domain)) +
((secure == true) ?
"; secure"
:
""
);
};
Cookies.get =
function
(name){
var
arg = name +
"="
;
var
alen = arg.length;
var
clen = document.cookie.length;
var
i = 0;
var
j = 0;
while
(i
<p>4
function
.php</p>
<p><img src=
"/inc/test.jsp?url=http%3A%2F%2Fimages.cnblogs.com%2FOutliningIndicators%2FContractedBlock.gif&refer=http%3A%2F%2Fwww.cnblogs.com%2Fheheisme%2Fp%2F3384827.html"
alt=
"PHP与JavaScript下的Cookie操作"
><span>View Code</span></p>
<p> </p>
<p> </p>
<p> </p>
<p>http: