<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<html xmlns="/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312" />
<title>js 设置cookie与删除cookie</title>
<script>
function setcookie(sname, svalue, sexpires)
{
var scookie = sname + "=" + encodeuricomponent(svalue);
if (sexpires != null)
{
scookie += "; expires=" + sexpires;
}
document.cookie = scookie;
}
function removecookie(sname,svalue)
{
document.cookie = sname + "=; expires=fri, 31 dec 1999 23:59:59 gmt;";
}
//设置cookie
setcookie('111cn.net', 'www.111cn.net', 'fri, 31 dec 2030 23:59:59 gmt;')
//删除cookie
removecookie('111cn.net','www.111cn.net')
</script>
</head>
<body>
</body>
</html>